[CMake] How to invoke a separate build with CMAKE_CUSTOM_TARGET?

Heine, Christian (EXTERN: VWGEDS) extern.christian.heine at volkswagen.de
Thu May 12 08:51:42 EDT 2011


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)  

# Find our cmake utils with different reusable macros
FIND_PACKAGE(OpenGL REQUIRED)

# create exectuable
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
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
)

>Mit freundlichen Grüßen
>
Christian Heine

T-Systems on site services GmbH
Procurement Systems

>Telefon/phone: +49-5361-9-78564
>E-Mail: extern.christian.heine at volkswagen.de
>
--------------------------------------------------------------------------------

Christian Heine
Consultant
Alessandro-Volta-Straße 11, 38440 Wolfsburg
+49-5361-464 78-x (Tel.)
+49-5361-464 78-10 (Fax)
E-Mail: christian.heine at t-systems.com
Internet: http://www.t-systems-onsite.de 

Geschäftsführung: Stefan Kappe, Georg Rätker
Handelsregister: Amtsgericht Berlin HRB 51336
Sitz der Gesellschaft: Berlin
Ust.-Id Nr. DE 181 120 485

--------------------------------------------------------------------------------

Notice: This transmittal and/or attachments may be privileged or confidential. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, or copying is strictly prohibited. If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you.

-----Ursprüngliche Nachricht-----
Von: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] Im Auftrag von Rolf Eike Beer
Gesendet: Donnerstag, 12. Mai 2011 13:39
An: cmake at cmake.org
Betreff: Re: [CMake] How to invoke a separate build with CMAKE_CUSTOM_TARGET?

Am Donnerstag, 12. Mai 2011, 12:40:54 schrieb Heine, Christian:
> Thanks Eike for this hint! This works, but I couldn't use it.
> 
> One reason is, that any module is loosely coupled. It doesn't know where the
> other modules it's depends on are located. By this reason I need a place
> where any final library is archived and could be linked by the executable
> at runtime like the /usr/local/lib folder on Linux, so I think the system32
> folder is the right place on windows platforms ...
> 
> The second reason is, that I've to perform an installation before I could
> start the demo files. But normally I would start them before I install the
> module, i.e. to test implementation details. By this reason the demo
> executable must be able to link the actual library after a simple build...

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

This will create a lib and bin folder inside your build tree where all things 
will be located so it should be possible to run things just from the build 
tree. BTDT. MT.

Eike


More information about the CMake mailing list