[CMake] what is the right way to set CMAKE_USE_RELATIVE_PATHS?

Claus Klein claus.klein at arcormail.de
Mon Dec 21 16:22:55 EST 2009


John Drescher schrieb:
> On Mon, Dec 21, 2009 at 3:50 PM, Claus Klein <claus.klein at arcormail.de> wrote:
>   
>> Hi all,
>>
>> I tried to use:
>>   set(CMAKE_USE_RELATIVE_PATHS ON)
>> in my CMakeLists.txt.
>>
>> But I noticed, that some cmake variables can't be changed in that way.
>> In the CMakeCache.txt, it is still OFF?
>>
>>     
> I have no idea about CMAKE_USE_RELATIVE_PATHS since I have never
> needed/wanted to use that however for the other cases that it appears
> the CMake does not let me change a value I usually get around this
> using the following examples:
>
> SET (CMAKE_INSTALL_PREFIX ${PGM_FILES}/UPMC/${CMAKE_PROJECT_NAME}
> CACHE STRING "Default Install Path" FORCE)
>
>
> IF (MAKE_DEBUGRELEASE)
> SET (CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING
> "Debug;RelWithDebInfo" FORCE)
> SET (RELEASE_BUILD_NAME "RelWithDebInfo")
> ELSE(MAKE_DEBUGRELEASE)
> SET (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
> "Debug;Release" FORCE)
> SET (RELEASE_BUILD_NAME "Release")
> ENDIF (MAKE_DEBUGRELEASE)
>
>
> The keys are CACHE and FORCE.
>
>
> John
>   
Thanks John,

I know the FORCE option.
But I tried to understand for which CMake variables I have to use FORCE 
and why?
Is it really necessary to write so much configuration when I simply want 
to change a default value?

For the CMAKE_BUILD_TYPE it is documented, quote from CMake FAQ:

IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)


Claus


More information about the CMake mailing list