2009/2/17 Pavel Shevaev <[email protected]>:
> Folks, what can be the reason for install target not to be called? I
> have something like this in my CMakeLists.txt:
>
>  add_executable(foo src1 src2 src3)
>  target_link_libraries(foo ${libs})
>  install(PROGRAMS ${foo_BINARY_DIR}/foo
>           DESTINATION ${foo_SOURCE_DIR}/bin
>          )

If your binary to install is a CMake target (like in your example)
you should use:

install(targets foo
            RUNTIME DESTINATION  ${foo_SOURCE_DIR}/bin)

moreover installing in ${foo_SOURCE_DIR} is a bit strange,
if you want to collect all your compiled executable in
a "bin" directory of the source tree then you may
try to use

CMAKE_RUNTIME_OUTPUT_DIRECTORY

if you do

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

after calling make, all your executable will end up in
${PROJECT_SOURCE_DIR}/bin

finally you usually don't want to put compiled executable in the SOURCE tree
but in the BUILD tree. So one usually do:
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)


-- 
Erk
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to