diff options
author | Robert Adam <dev@robert-adam.de> | 2022-09-08 13:41:45 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2022-09-10 18:28:34 +0300 |
commit | 09a17879f8680abd89f6c7d1e62a0f2132e588dc (patch) | |
tree | ac246e6629635ddeac0072594b6f8667b25b4f0e | |
parent | b61091dbd7b07b01c64f7df65d2bef029f4528ff (diff) |
BUILD(cmake): Use EXCLUDE_FROM_ALL for 3rdparty subdirs
This prevents adding all targets in said subdirectories to the ALL
target by default. Instead, only those targets that are explicitly
referenced (e.g. via target_link_libraries) are built.
This also has the side-effect that any install-directives in these
subdirectories are also ignored for the default install targets which
prevents these libraries of unconditionally installing themselves when
issuing a make install. Instead, we now have to make any 3rdparty
component that we do indeed want to install, do so explicitly (e.g. via
install_library()).
-rw-r--r-- | overlay_gl/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/mumble/CMakeLists.txt | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/overlay_gl/CMakeLists.txt b/overlay_gl/CMakeLists.txt index 4b20759c2..4a0a2dc67 100644 --- a/overlay_gl/CMakeLists.txt +++ b/overlay_gl/CMakeLists.txt @@ -101,7 +101,7 @@ if(NOT APPLE) endif() endif() else() - add_subdirectory("${3RDPARTY_DIR}/mach-override-build" "${CMAKE_CURRENT_BINARY_DIR}/mach-override") + add_subdirectory("${3RDPARTY_DIR}/mach-override-build" "${CMAKE_CURRENT_BINARY_DIR}/mach-override" EXCLUDE_FROM_ALL) find_library(LIB_COREFOUNDATION "CoreFoundation") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index afc09be06..e73133483 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -205,7 +205,7 @@ set(TRACY_ON_DEMAND ON CACHE BOOL "" FORCE) # (can cause issues for packagers as that dependency is retained even though Tracy is disabled) set(PREV_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -add_subdirectory("${3RDPARTY_DIR}/tracy" "tracy") +add_subdirectory("${3RDPARTY_DIR}/tracy" "tracy" EXCLUDE_FROM_ALL) disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/tracy") message(STATUS "Tracy: ${TRACY_ENABLE}") @@ -216,7 +216,7 @@ target_link_libraries(shared PUBLIC Tracy::TracyClient) # Add the GSL if(bundled-gsl) - add_subdirectory("${3RDPARTY_DIR}/gsl" "${CMAKE_CURRENT_BINARY_DIR}/gsl") + add_subdirectory("${3RDPARTY_DIR}/gsl" "${CMAKE_CURRENT_BINARY_DIR}/gsl" EXCLUDE_FROM_ALL) target_link_libraries(shared PUBLIC GSL) else() diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index abe2820d0..585f09f47 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -506,7 +506,7 @@ endif() if(bundled-json) set(JSON_BuildTests OFF CACHE INTERNAL "") set(JSON_ImplicitConversions OFF CACHE INTERNAL "") - add_subdirectory("${3RDPARTY_DIR}/nlohmann_json/" "${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json/") + add_subdirectory("${3RDPARTY_DIR}/nlohmann_json/" "${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json/" EXCLUDE_FROM_ALL) else() find_pkg("nlohmann_json" REQUIRED) endif() @@ -596,7 +596,7 @@ if(WIN32) target_link_libraries(mumble_client_object_lib PUBLIC Qt5::QWindowsIntegrationPlugin) endif() - add_subdirectory("${3RDPARTY_DIR}/xinputcheck-build" "${CMAKE_CURRENT_BINARY_DIR}/xinputcheck") + add_subdirectory("${3RDPARTY_DIR}/xinputcheck-build" "${CMAKE_CURRENT_BINARY_DIR}/xinputcheck" EXCLUDE_FROM_ALL) # Disable all warnings that the xinputcheck code may emit disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/xinputcheck-build") @@ -698,7 +698,7 @@ if(bundled-opus) option(OPUS_STACK_PROTECTOR "" OFF) endif() - add_subdirectory("${3RDPARTY_DIR}/opus" "${CMAKE_CURRENT_BINARY_DIR}/opus") + add_subdirectory("${3RDPARTY_DIR}/opus" "${CMAKE_CURRENT_BINARY_DIR}/opus" EXCLUDE_FROM_ALL) # Disable all warnings that the Opus code may emit disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/opus") @@ -725,7 +725,7 @@ else() endif() if(bundled-speex) - add_subdirectory("${3RDPARTY_DIR}/speexdsp-build" "${CMAKE_CURRENT_BINARY_DIR}/speexdsp") + add_subdirectory("${3RDPARTY_DIR}/speexdsp-build" "${CMAKE_CURRENT_BINARY_DIR}/speexdsp" EXCLUDE_FROM_ALL) # Disable all warnings that the speexdsp code may emit disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/speexdsp-build") @@ -754,7 +754,7 @@ if(rnnoise) target_compile_definitions(mumble_client_object_lib PRIVATE "USE_RNNOISE") if(bundled-rnnoise) - add_subdirectory("${3RDPARTY_DIR}/rnnoise-build" "${CMAKE_CURRENT_BINARY_DIR}/rnnoise") + add_subdirectory("${3RDPARTY_DIR}/rnnoise-build" "${CMAKE_CURRENT_BINARY_DIR}/rnnoise" EXCLUDE_FROM_ALL) # Disable all warnings that the RNNoise code may emit disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/rnnoise-build") |