Skip to content

Commit

Permalink
cmake PROJECT_IS_TOP_LEVEL (#252)
Browse files Browse the repository at this point in the history
This reverts commit f6b9b7f.

This commit needs to include package manager creation for conan and
vcpkg before it can be merged since it broke building for at lesat
conan.
  • Loading branch information
jbaldwin committed Feb 14, 2024
1 parent c05d207 commit 891b20b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ if (NOT "$ENV{version}" STREQUAL "")
endif()

option(LIBCORO_EXTERNAL_DEPENDENCIES "Use Cmake find_package to resolve dependencies instead of embedded libraries, Default=OFF." OFF)
option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON)
option(LIBCORO_CODE_COVERAGE "Enable code coverage, tests must also be enabled, Default=OFF" OFF)
option(LIBCORO_BUILD_EXAMPLES "Build the examples, Default=ON." ON)
option(LIBCORO_RUN_GITCONFIG "Set the githooks directory to auto format and update the readme, Default=OFF." OFF)
option(LIBCORO_BUILD_SHARED_LIBS "Build shared libraries, Default=OFF." OFF)

Expand All @@ -37,8 +35,19 @@ if (LIBCORO_RUN_GITCONFIG)
)
endif()

cmake_dependent_option(LIBCORO_FEATURE_NETWORKING "Include networking features, Default=ON." ON "NOT EMSCRIPTEN; NOT MSVC" OFF)
cmake_dependent_option(LIBCORO_FEATURE_TLS "Include TLS encryption features, Default=ON." ON "NOT EMSCRIPTEN; NOT MSVC" OFF)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
set(LIBCORO_PROJECT_IS_TOP_LEVEL "${PROJECT_IS_TOP_LEVEL}")
else()
get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY)
if(NOT not_top)
set(LIBCORO_PROJECT_IS_TOP_LEVEL true)
endif()
endif()

cmake_dependent_option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON "LIBCORO_PROJECT_IS_TOP_LEVEL" OFF)
cmake_dependent_option(LIBCORO_BUILD_EXAMPLES "Build the examples, Default=ON." ON "LIBCORO_PROJECT_IS_TOP_LEVEL" OFF)
cmake_dependent_option(LIBCORO_FEATURE_NETWORKING "Include networking features, Default=ON." ON "NOT EMSCRIPTEN; LINUX" OFF)
cmake_dependent_option(LIBCORO_FEATURE_TLS "Include TLS encryption features, Default=ON." ON "NOT EMSCRIPTEN; LINUX" OFF)

message("${PROJECT_NAME} LIBCORO_EXTERNAL_DEPENDENCIES = ${LIBCORO_EXTERNAL_DEPENDENCIES}")
message("${PROJECT_NAME} LIBCORO_BUILD_TESTS = ${LIBCORO_BUILD_TESTS}")
Expand Down

0 comments on commit 891b20b

Please sign in to comment.