[CMake] install(script ... and memory loss

Eric Noulard eric.noulard at gmail.com
Tue Jul 26 08:57:10 EDT 2011


2011/7/26 Micha Renner <Micha.Renner at t-online.de>:
> In a CMakeLists file, there is this command:
>
> INSTALL(SCRIPT tInstall.txt)
>
> During processing tInstall.txt none of global variables (e.g. MSVC,
> CMAKE_SHARED_LIBRARY_SUFFIX ...) has a value.
>
> Is this a bug or a feature?

Feature...

At Install-time CMake is running in script mode and almost all vars you have in
the CMake-time context (within CMakeLists.txt) are not set.

If you want CMake-time var values available in your Install-time script
you'll have to either:

1) load some CMake-time generated file which contains the values

2) configure/generated your Install-time script itself

     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tInstall.txt.in
${CMAKE_CURRENT_BINARY_DIR}/tInstall.txt)
     install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/tInstall.txt)


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list