[CMake] specifying path for license file for commercial compiler?

Juan E. Sanchez juan.e.sanchez at gmail.com
Sun Jul 8 22:32:04 EDT 2018


Hi,

Could you create a simple compiler wrapper script, and point the 
CMAKE_*_COMPILER variables there:

#!/bin/bash
export INTEL_LICENSE_FILE=/usr/local/intel/license
/path/to/ifort "$@"

Regards,

Juan


On 7/8/18 8:41 PM, Clune, Thomas L. (GSFC-6101) wrote:
> Unfortunately, I cannot dictate where the sysadmins are putting the 
> license file.     I can of course put a copy in  /home/<user>/Licenses 
> which is another location that Intel looks by default.   And if there is 
> no better solution, I will provide instructions to all of our developers 
> on making copies themselves on our various development platforms.    Or 
> at that point I’ll just ask them all to set the environment variable in 
> their shell startup files.
> 
> I’m still a bit astonished that something as simple as this is 
> essentially unsupported.    It is particularly frustrating as try_run() 
> successfully exercises the compiler while the run-of-the-mill compiler 
> invocations under make do not. Sort of makes sense though.  CMake 
> launches try_run() in a subshell and therefore it sees the env variable 
> I am setting with set(ENV…).   OTOH, the subsequent make commands are 
> not subshells and therefore need a separate mechanism to see that env 
> variable.
> 
> *From: *Stephen McDowell <sjm324 at cornell.edu>
> *Date: *Saturday, July 7, 2018 at 2:25 AM
> *To: *Marc CHEVRIER <marc.chevrier at gmail.com>
> *Cc: *"Clune, Thomas L. (GSFC-6101)" <thomas.l.clune at nasa.gov>, CMake 
> MailingList <cmake at cmake.org>
> *Subject: *Re: [CMake] specifying path for license file for commercial 
> compiler?
> 
> I agree that a toolchain file is more appropriate, noting that typically 
> modifying the environment variables is much more common for there's 
> compilers (particularly using environment modules).
> 
> However, since you've started clearly you would rather not set the 
> environment variables, there may be an easier "hack".
> 
> Intel also looks in /opt/intel/licenses for any .lic files. So if you 
> want, you can just create a symbolic link or copy your license file there :)
> 
> On Fri, Jul 6, 2018, 10:49 PM Marc CHEVRIER <marc.chevrier at gmail.com 
> <mailto:marc.chevrier at gmail.com>> wrote:
> 
>     May be using a toolchain file is more appropriate. See
> 
>     https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html
> 
>     Le ven. 6 juil. 2018 à 22:59, Clune, Thomas L. (GSFC-6101)
>     <thomas.l.clune at nasa.gov <mailto:thomas.l.clune at nasa.gov>> a écrit :
> 
>         To use the Intel compiler, one must use an environment variable
>         that specifies the path to the license file.  E.g.,
> 
>              export INTEL_LICENSE_FILE=/usr/local/intel/license
> 
>         Other commercial compilers use a very similar mechanism.    I
>         had hoped to capture such information in a cache file so that I
>         could avoid polluting the shell where I am invoking cmake:
> 
>              % cmake -C my-cache <src-dir>
> 
>         Such a cache file could  look like:
> 
>              set(CMAKE_Fortran_COMPILER
>         "/usr/local/intel/2018/compilers_and_libraries_2018.3.222/linux/bin/intel64/ifort"
>         CACHE path "Fortran compiler")
>              set(ENV{INTEL_LICENSE_FILE} "/usr/local/intel/license"
>         CACHE path "Intel license")
> 
> 
>         Unfortunately, the compiler is not “seeing” the env variable and
>         complains that there is no license.     Is there a solution to
>         this, or am I forced to set the env variable each time I try to
>         build?
> 
> 
> 
> 
> 
> 
> 
>         -- 
> 
>         Powered by www.kitware.com <http://www.kitware.com>
> 
>         Please keep messages on-topic and check the CMake FAQ at:
>         http://www.cmake.org/Wiki/CMake_FAQ
> 
>         Kitware offers various services to support the CMake community.
>         For more information on each offering, please visit:
> 
>         CMake Support: http://cmake.org/cmake/help/support.html
>         CMake Consulting: http://cmake.org/cmake/help/consulting.html
>         CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
>         Visit other Kitware open-source projects at
>         http://www.kitware.com/opensource/opensource.html
> 
>         Follow this link to subscribe/unsubscribe:
>         https://cmake.org/mailman/listinfo/cmake
> 
>     -- 
> 
>     Powered by www.kitware.com <http://www.kitware.com>
> 
>     Please keep messages on-topic and check the CMake FAQ at:
>     http://www.cmake.org/Wiki/CMake_FAQ
> 
>     Kitware offers various services to support the CMake community. For
>     more information on each offering, please visit:
> 
>     CMake Support: http://cmake.org/cmake/help/support.html
>     CMake Consulting: http://cmake.org/cmake/help/consulting.html
>     CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
> 
>     Follow this link to subscribe/unsubscribe:
>     https://cmake.org/mailman/listinfo/cmake
> 
> 
> 



More information about the CMake mailing list