[CMake] find_package and install

Lars Lars laasunde at hotmail.com
Thu Aug 29 05:04:46 EDT 2013


Hello,


I have the following configuration;


FIND_PACKAGE(Qt4 4.7.1 COMPONENTS QtCore)

IF (Qt4_FOUND)

    INCLUDE(${QT_USE_FILE})

    MESSAGE(STATUS "QT_LIBRARIES:${QT_LIBRARIES}")

ENDIF()
 


# setup header and source files


 
ADD_EXECUTABLE(TBD ${_SOURCES} ${_HEADERS})

TARGET_LINK_LIBRARIES(TBD ${QT_LIBRARIES})


 
The message outputs;

QT_LIBRARIES:optimized;c:/tools/Qt_r/4.7.1-vs2005/lib/QtCore4.lib;debug;c:/tools/Qt_r/4.7.1-vs2005/lib/QtCored4.lib


 
So the target_link_libraries decode the content in QT_LIBRARIES variable to determine which library to link against. In this example that means if cmake_build_type is equal "release" then the optimized library is used. If cmake_build_type is equal "debug" then the debug library is used. This is a simple description of what happens.
 


Next I need to install the qt libraries. I am able to determine library path based on lib path. How do I determine to use "optimized" or "debug" or "general"? It would be great if this algorithm was the same as the one used by target_link_libraries api to select which library to link against.
 
Appreciate any input.

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130829/dbd689c4/attachment.htm>


More information about the CMake mailing list