[CMake] Renaming output of EXECUTABLE

William A. Hoffman billlist at nycap.rr.com
Thu Dec 1 11:14:16 EST 2005


At 10:55 AM 12/1/2005, Darko Miletic wrote:
>Reggie Burnett wrote:
>> Thanks Darko.  I'm very new to cmake so even some of the simple things
>> currently escape me.  Can I also use a variable for the target?  
>> 
>> ADD_EXECUTABLE(${EXENAME} ${SRCS})
>
>Of course. You can even modify the filename based on some conditions:
>
>IF    (CMAKE_BUILD_TYPE MATCHES Debug)
>  SET(DBG "_dbg")
>ELSE  (CMAKE_BUILD_TYPE MATCHES Debug)
>  SET(DBG "")
>ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
>
>SET (EXENAME baseexename${DBG})
>
>ADD_EXECUTABLE(${EXENAME} ${SRCS})


The only problem with this approach is that it will not work with visual studio
or XCode IDE's.  Those project types do not use the CMAKE_BUILD_TYPE since
they have multiple build types in one project anyway.


-Bill



More information about the CMake mailing list