Skip to content

Commit

Permalink
Don't enforce the set of features crow was installed with but instead…
Browse files Browse the repository at this point in the history
… give the ability to freely choose them, even after it was installed.
  • Loading branch information
luca-schlecker committed Sep 30, 2021
1 parent a22c5da commit 258e0f5
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions cmake/CrowConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@PACKAGE_INIT@

set(CROW_ENABLE_COMPRESSION @CROW_ENABLE_COMPRESSION@)
set(CROW_ENABLE_SSL @CROW_ENABLE_SSL@)

include(CMakeFindDependencyMacro)
find_dependency(Boost 1.64 COMPONENTS system date_time)
find_dependency(Threads)
Expand All @@ -17,3 +14,24 @@ endif()

include("${CMAKE_CURRENT_LIST_DIR}/CrowTargets.cmake")
check_required_components("@PROJECT_NAME@")

get_target_property(_CROW_ILL Crow::Crow INTERFACE_LINK_LIBRARIES)
get_target_property(_CROW_ICD Crow::Crow INTERFACE_COMPILE_DEFINITIONS)

list(REMOVE_ITEM _CROW_ILL "ZLIB::ZLIB" "OpenSSL::SSL")
list(REMOVE_ITEM _CROW_ICD "CROW_ENABLE_SSL" "CROW_ENABLE_COMPRESSION")

if(CROW_ENABLE_COMPRESSION)
list(APPEND _CROW_ILL "ZLIB::ZLIB")
list(APPEND _CROW_ICD "CROW_ENABLE_COMPRESSION")
endif()

if(CROW_ENABLE_SSL)
list(APPEND _CROW_ILL "OpenSSL::SSL")
list(APPEND _CROW_ICD "CROW_ENABLE_SSL")
endif()

set_target_properties(Crow::Crow PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${_CROW_ICD}"
INTERFACE_LINK_LIBRARIES "${_CROW_ILL}"
)

1 comment on commit 258e0f5

@autoantwort
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I don't know if that is a good idea. If vcpkg installs the package with openssl and zlib enabled the consuming user still have to set CROW_ENABLE_COMPRESSION and CROW_ENABLE_SSL before the find_package call?

Please sign in to comment.