[CMake] Adding CMAKE_BUILD_TYPE support to ProjectConfig.cmake

Mateusz Loskot mateusz at loskot.net
Mon Dec 16 11:59:00 EST 2013


Hi,

I've started adding the config mode support to my CMake-based
projects and with quite a success.

So far, I have basic understanding of what it takes in practice to enable
config mode and there is still more to learn for me.

TL;TR: How to make use of CMAKE_BUILD_TYPE in config mode?
Could anyone update the tutorial [1] with related notes?

I'm considering basic scenario:
- FooBar is a library with ProjectConfig.cmake support
- FooBarUser is an external project that find_package() the FooBar
and links against FooBar through its exported target
- during development, FooBar is *not* installed, but referred to from
its build directory

How can FooBarUser look for and link against Debug or Release variant
of FooBar depending on CMAKE_BUILD_TYPE,
given both variants live in separate directories?

How does the package registry work here?

[1] http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file

Best regards,
-- 
Mateusz  Łoskot, http://mateusz.loskot.net


More information about the CMake mailing list