[CMake] find_package and install

Craig Scott audiofanatic at gmail.com
Thu Aug 29 06:41:56 EDT 2013


Have a look for install_qt4_executable. We've been using that instead of having to explicitly install the Qt libraries ourselves. Much easier to maintain and it seems to deal well with all the platform differences.

PS: I'm going from memory so I might have the name of that function slightly wrong. 

--
Craig Scott


On 29/08/2013, at 7:04 PM, Lars Lars <laasunde at hotmail.com> wrote:

> 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.
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130829/6cde9cbe/attachment.htm>


More information about the CMake mailing list