1. build your own project, too, in separate build trees for debug and
release
2. if all your dependencies' are prepared to provide debug and release libs
simultanously (like Poco) you can build them in separate trees (however not
neccessary) but set CMAKE_INSTALL_PREFIX and CMAKE_PREFIX_PATH to the same
location for each configuration
3. you can examine CMakeCache.txt and find which variable is cached during
find_package and remove it manually (unset(... CACHE)) but this is a hack

Tamas

On Fri, Sep 25, 2015 at 11:58 AM, John Barbero Unenge <
[email protected]> wrote:

> I'm tearing my hair out about how to include thrid party libraries in my
> cmake project. Currently I build Poco and a bunch of others that all
> generate their respective <LibName>Config.cmake which I use with
> find_package. I have a wrapping build script that builds all of my
> dependencies and package them separately for debug and release (I don't
> want to tweak their cmake-scripts unless I really really really need to
> because maintanance).
>
> I thought I could just do:
>
> find_package(Foo
>             HINTS "${CMAKE_SOURCE_DIR}/some/path/debug/libFoo/lib/cmake"
>             REQUIRED
> )
> get_target_property(LIB_FOO_DEBUG lib_foo LOCATION)
>
> find_package(Foo
>             HINTS "${CMAKE_SOURCE_DIR}/some/path/release/libFoo/lib/cmake"
>             REQUIRED
> )
> get_target_property(LIB_FOO_RELEASE lib_foo LOCATION)
>
> set(LIB_FOO_LIBRARIES optimized "${LIB_FOO_RELEASE}" debug
> "${LIB_FOO_DEBUG}")
>
> message("LIB_FOO_LIBRARIES: \"${LIB_FOO_LIBRARIES}\"")
> # Gives: LIB_FOO_LIBRARIES: "
> optimized;C:/path/to/proj/some/path/debug/libFoo/lib/foo.lib;debug;C:/path/to/proj/some/path/debug/libFoo/lib/foo.lib"
>
> It seems like the first call to find_package for target Foo is cached,
> whis I don't really want.
>
> Am I going about this the wrong way? How do I properly work with 3rd party
> libraries with the Visual Studio generator?
>
> Any pointers are greatly appreciated.
>
> / John
>
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake
>
-- 

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://public.kitware.com/mailman/listinfo/cmake

Reply via email to