[CMake] How to invoke a separate build with CMAKE_CUSTOM_TARGET?
Rolf Eike Beer
eike at sf-mail.de
Thu May 12 11:28:31 EDT 2011
Am Donnerstag, 12. Mai 2011, 14:51:42 schrieb Heine, Christian:
> Hmm, this is strange. I've followed your instructions, but those take no
> effect. When i try to run the executable I got the failure message box that
> my libbrOpenGL.dll of the acutal build result is missing. Here is what I do
> on demo build:
>
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
> ${CMAKE_CURRENT_SOURCE_DIR}
> ${CMAKE_SOURCE_DIR}/include
> ${COMPILER_ROOT}/include/binrev
> )
>
> # Find OpenGL library using default CMake find script
> FIND_PACKAGE(OpenGL REQUIRED)
>
> # create output directory
> SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
>
> # Make sure the linker can find our libraries once they are built.
> LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib)
This is basically always wrong. Since you usually pass absolute paths to
target_link_libraries() this doesn't help in any way but may cause trouble.
Just don't do it.
> # Find our cmake utils with different reusable macros
> FIND_PACKAGE(OpenGL REQUIRED)
You already did that before.
> # create exectuable
> SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
Since CMAKE_RUNTIME_OUTPUT_DIRECTORY is already set you should not need that
anymore.
> ADD_EXECUTABLE(mydemo demo_win32Camera.cpp)
>
> #link test libraries for unit tests
> TARGET_LINK_LIBRARIES( mydemo
> brOpenGL # this is the library of the actual build
> brCore brMath brGraphics # this are other required
libs
> )
These br* things are be created by add_library(... shared ...) in your
project, no? Then this should work if you had previously set
CMAKE_LIBRARY_OUTPUT_DIRECTORY to bin or so.
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110512/49427ca7/attachment.pgp>
More information about the CMake
mailing list