[CMake] restricting Qt include and library linking to 1 library/project

Pau Garcia i Quiles pgquiles at elpauer.org
Thu Dec 31 10:33:04 EST 2009


On Thu, Dec 31, 2009 at 4:06 PM, Hicham Mouline <hicham at mouline.org> wrote:

>> Assuming lib1 uses QtCore and QtNetwork:
>>
>> find_package( Qt4 COMPONENTS QtCore QtNetwork REQUIRED )
>> include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR}
> )
>> add_library( lib1 SHARED lib1_source1.cpp lib1_source2.cpp ... )
>> target_link_libraries( lib1 ${QT_QTCORE_LIBRARIES}
> ${QT_QTNETWORK_LIBRARIES} )
>
> Does this take care of both release and debug libraries?
> Ie, in release build, it will include release libs and in debug debug libs?

Yes, it does. Take a look at FindQt4.cmake for the details.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list