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

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Fri Jul 6 16:34:04 EDT 2018


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?









More information about the CMake mailing list