Hi!

I have some trouble using a target's LOCATION property in order to build
a custom command. Maybe someone can tell me if this is by design and
whether I can do what I intend to.

I have a target that has a changed name as well as an added postfix for
the Debug configuration.

ADD_EXECUTABLE( test test.c )
SET_TARGET_PROPERTIES( test PROPERTIES OUPUT_NAME hello )
SET_TARGET_PROPERTIES( test PROPERTIES DEBUG_POSTFIX d )

So now I expect the resulting executable to be called "hello"
respectively "hellod" when building in Debug configuration. So far this
is working. 

Now I want to add a custom command which acts on the executable. Let's
say I want to copy it someplace else. My problem is, how can I address
the executable in the custom command? Consider the following example
custom command.

ADD_CUSTOM_COMMAND( TARGET test POST_BUILD COMMAND cp ${PROGRAM}
someplace )

The thing is, how can I set the PROGRAM variable to the correct name and
path of the executable built? Because simply using the LOCATION property
won't work for the Debug configuration as it will use the standard name
"hello". The DEBUG_LOCATION gives the correct name, with the 'd'
appended. But that means that I would have to actually check for the
BUILD_TYPE and set the PROGRAM variable using the correct LOCATION type.
Which begs the question (as I haven't tested that yet) if that actually
works for building MSVS8 project files, too.  

Isn't there some way to get "just the right" value of LOCATION for the
current BUILD_TYPE without having to explicitely checking every possible
build type?

Thanks,
Florian

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to