[CMake] How to source a shell script from CMAKE

David Cole david.cole at kitware.com
Fri Feb 10 17:54:29 EST 2006


I'm not 100% sure, but I think the best you can do is write a wrapper 
shell script that first sources the shell script you're interested in 
and then calls cmake...

HTH,
David

Linton, Tom wrote:

>Thanks for the reply, Filipe but this isn't quite what I'm asking.
>Yes, I know that I can change the path to the compiler either from
>the command line or from within CMAKE. 
>
>But what I want to do is to source a file that sets up various
>paths and environment variables in addition to the compiler
>paths. Yes, I could manually do this 
>within CMakeLists.txt but I'd rather source the actual file that
>is installed in the compiler distribution tree, to ensure I am
>using the correct environment. And I want to do it from within
>CMakeLists.txt rather than in a .bashrc or other personal file
>because these builds are being done by many people and I want
>the configuration to be fully defined in the CMakeLists.txt file
>itself.
>
>Thanks
>
>Tom
>
>-----Original Message-----
>From: cmake-bounces+tom.linton=intel.com at cmake.org
>[mailto:cmake-bounces+tom.linton=intel.com at cmake.org] On Behalf Of
>Filipe Sousa
>Sent: Thursday, February 09, 2006 4:32 PM
>To: cmake at cmake.org
>Subject: Re: [CMake] How to source a shell script from CMAKE
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Linton, Tom wrote:
>  
>
>>The Intel icc compiler has a standard shell script called "iccvars.sh"
>>that is normally sourced to set up the environment for the compiler.
>>    
>>
>Is
>  
>
>>there a good way to ensure that this gets sourced from within CMAKE?
>>    
>>
>
>CC=icc CXX=icpc cmake path/to/your/source/project
>
>  
>
>>One option is to write a driver script "iccdriver" that sources
>>iccvars.sh and then set the CMAKE_CXX_COMPILER variable to point to
>>    
>>
>this
>
>another option is exporting CC and CXX in your profile:
>echo "export CC=icc" >> ${HOME}/.bashrc
>echo "export CXX=icpc" >> ${HOME}/.bashrc
>
>  
>
>>script, but that seems a round-about approach. I'd like to be able to
>>just source iccvars from within my CMakeLists.txt file somehow.
>>    
>>
>
>- --
>Filipe Sousa
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.2 (GNU/Linux)
>
>iD8DBQFD697qbQdNYqwwwCwRAgNSAJ4zDdR0psd3ZB8JvwESxQJKozFSdQCfTAP3
>Au6Pk2T6v63cvOg13UGgfHE=
>=CcpF
>-----END PGP SIGNATURE-----
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>
>  
>


More information about the CMake mailing list