[cmake-developers] [CMake 0013439]: consecutive find_package(Boost ...) statements only find the static lib regardless of Boost_USE_STATIC_LIBS
Mantis Bug Tracker
mantis at public.kitware.com
Wed Jul 25 17:33:14 EDT 2012
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=13439
======================================================================
Reported By: Pieter Swinkels
Assigned To:
======================================================================
Project: CMake
Issue ID: 13439
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-07-25 17:33 EDT
Last Modified: 2012-07-25 17:33 EDT
======================================================================
Summary: consecutive find_package(Boost ...) statements only
find the static lib regardless of Boost_USE_STATIC_LIBS
Description:
Consecutive find_package(Boost ...) statements for the same Boost component in
the same file CMakeLists.txt but
- the first time with Boost_USE_STATIC_LIBS to ON and
- the second time with BOOST_USE_STATIC_LIBS to OFF
always finds the static library.
Steps to Reproduce:
Try something like this:
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
# ${BOOST_LIBRARIES} contains the static version of the library
add_executable(my-static-find-package-boost-test main-static.cpp)
target_link_libraries(my-static-find-package-boost-test ${Boost_LIBRARIES})
unset(Boost_LIBRARIES)
message("Boost_LIBRARIES: ${Boost_LIBRARIES}")
set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
# ${BOOST_LIBRARIES} still contains the static version of the library
add_executable(my-dynamic-find-package-boost-test main-dynamic.cpp)
target_link_libraries(my-dynamic-find-package-boost-test ${Boost_LIBRARIES})
Additional Information:
It is not that the dynamic library cannot be found. If I uncomment the first
invocation, clear the cache (!) and run cmake, the dynamic library is found.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-07-25 17:33 Pieter SwinkelsNew Issue
======================================================================
More information about the cmake-developers
mailing list