[CMake] LOCATION in VS

Brad Aisa Brad.Aisa at Colorado.EDU
Thu Dec 11 03:04:02 EST 2008


I am trying to use the LOCATION property of a library target in VS. VS 
is a bit complicated, because a single generate creates all 4 targets 
(Debug, Release, etc.) I want to add a custom target command. Here is 
what is in the file:

_targ is a variable that contains a previous created target (ex. "temt")


get_target_property(TARG_FILENAME ${_targ} LOCATION)

add_custom_command(TARGET ${_targ} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${TARG_FILENAME}
         ${CMAKE_HOME_DIRECTORY}/bin)

Now, in VS, for Debug, the target is correctly called:

Linker:Output:

C:\Users\baisa\Emergent\build_dbg\src\temt\lib\Debug\temt_dbg.dll


But the Post Build Event:Command Line for Debug configuration contains:

"C:\Program Files\CMake 2.6\bin\cmake.exe" -E copy 
C:/Users/baisa/Emergent/build_dbg/src/temt/lib/$(OutDir)/temt.dll 
C:/Users/baisa/Emergent/bin

Notice that the _dbg is missing

I tried fudging this by making the filename myself, and embedding a * 
wildcard, but it seems that the CMAKE copy command doesn't process 
wildcards.



More information about the CMake mailing list