[CMake] Unnecessary ordering breaks existing CMakeLists.txt

Brad King brad.king at kitware.com
Wed Aug 16 11:21:22 EDT 2006


Dataflow wrote:
> ----- Original Message ----- 
> From: "Brad King" <brad.king at kitware.com>
>> find_package(foo)
>> target_link_libraries(app ${foo_libraries})
>>
>> where foo_libraries contains something like
>> "/path/to/libfoo1.so;/path/to/libfoo2.so".
> 
> Tried that, but could not figure out how exactly to specify the libraries
> under Windows, where the debug/release libraries need to be picked
> appropriately. Giving both paths makes CMake pick up the first one, instead
> of one matching the needed build type. Your help (with a case where the lib
> is also made by CMake - this ought to be directly supported... and
> otherwise) will be most appreciated.

FOO_LIBRARIES can be set like this:

find_library(FOO1_LIBRARY_DEBUG NAMES foo1d ...)
find_library(FOO1_LIBRARY_RELEASE NAMES foo1 ...)
find_library(FOO2_LIBRARY_DEBUG NAMES foo2d ...)
find_library(FOO2_LIBRARY_RELEASE NAMES foo2 ...)
set(FOO1_LIBRARY debug ${FOO1_LIBRARY_DEBUG}
                 release ${FOO1_LIBRARY_RELEASE})
set(FOO2_LIBRARY debug ${FOO2_LIBRARY_DEBUG}
                 release ${FOO2_LIBRARY_RELEASE})
set(FOO_LIBRARIES ${FOO1_LIBRARY} ${FOO2_LIBRARY})

See FindQt4 for a non-trivial example of finding alot of libraries with
multiple configurations:

http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindQt4.cmake?root=CMake&view=markup

> The wiki example shows only Unix case.

Where did you see this example on the Wiki?

Thanks,
-Brad


More information about the CMake mailing list