mirror of
https://github.com/boostorg/cmake.git
synced 2026-01-19 04:02:15 +00:00
Move the Boost_USE_STATIC_LIBS check from -config to -config-version
This commit is contained in:
@@ -316,26 +316,6 @@ function(boost_install_target)
|
||||
set(CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/tmpinst/${LIB}-config.cmake")
|
||||
set(CONFIG_FILE_CONTENTS "# Generated by BoostInstall.cmake for ${LIB}-${__VERSION}\n\n")
|
||||
|
||||
if(TYPE STREQUAL "SHARED_LIBRARY")
|
||||
|
||||
string(APPEND CONFIG_FILE_CONTENTS "if(Boost_USE_STATIC_LIBS)\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " set(${LIB}_FOUND FALSE)\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " set(${LIB}_NOT_FOUND_MESSAGE \"Library is shared, but Boost_USE_STATIC_LIBS is \${Boost_USE_STATIC_LIBS}\")\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " return()\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS "endif()\n\n")
|
||||
|
||||
endif()
|
||||
|
||||
if(TYPE STREQUAL "STATIC_LIBRARY")
|
||||
|
||||
string(APPEND CONFIG_FILE_CONTENTS "if(DEFINED Boost_USE_STATIC_LIBS AND NOT Boost_USE_STATIC_LIBS)\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " set(${LIB}_FOUND FALSE)\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " set(${LIB}_NOT_FOUND_MESSAGE \"Library is static, but Boost_USE_STATIC_LIBS is \${Boost_USE_STATIC_LIBS}\")\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " return()\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS "endif()\n\n")
|
||||
|
||||
endif()
|
||||
|
||||
string(APPEND CONFIG_FILE_CONTENTS "if(Boost_VERBOSE OR Boost_DEBUG)\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS " message(STATUS \"Found ${LIB} \${${LIB}_VERSION} at \${${LIB}_DIR}\")\n")
|
||||
string(APPEND CONFIG_FILE_CONTENTS "endif()\n\n")
|
||||
@@ -478,6 +458,36 @@ function(boost_install_target)
|
||||
|
||||
endif()
|
||||
|
||||
if(TYPE STREQUAL "SHARED_LIBRARY")
|
||||
|
||||
file(APPEND "${CONFIG_VERSION_FILE_NAME}"
|
||||
|
||||
"\n"
|
||||
"# Do not return shared libraries when Boost_USE_STATIC_LIBS is ON\n"
|
||||
"if(NOT PACKAGE_VERSION_UNSUITABLE AND Boost_USE_STATIC_LIBS)\n"
|
||||
" set(PACKAGE_VERSION_UNSUITABLE TRUE)\n"
|
||||
" set(PACKAGE_VERSION \"\${PACKAGE_VERSION} (shared)\")\n"
|
||||
" return()\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
if(TYPE STREQUAL "STATIC_LIBRARY")
|
||||
|
||||
file(APPEND "${CONFIG_VERSION_FILE_NAME}"
|
||||
|
||||
"\n"
|
||||
"# Do not return static libraries when Boost_USE_STATIC_LIBS is OFF\n"
|
||||
"if(NOT PACKAGE_VERSION_UNSUITABLE AND DEFINED Boost_USE_STATIC_LIBS AND NOT Boost_USE_STATIC_LIBS)\n"
|
||||
" set(PACKAGE_VERSION_UNSUITABLE TRUE)\n"
|
||||
" set(PACKAGE_VERSION \"\${PACKAGE_VERSION} (static)\")\n"
|
||||
" return()\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
install(FILES "${CONFIG_VERSION_FILE_NAME}" DESTINATION "${CONFIG_INSTALL_DIR}")
|
||||
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user