mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 11:23:27 -04:00
Merge branch 'upd-fetchcontent' into 'master'
CMake: Update FetchContent EXCLUDE_FROM_ALL impl See merge request OpenMW/openmw!4777
This commit is contained in:
commit
71ff1fb7bb
66
extern/CMakeLists.txt
vendored
66
extern/CMakeLists.txt
vendored
@ -3,19 +3,31 @@
|
||||
set(CMAKE_CXX_CLANG_TIDY "")
|
||||
|
||||
# Like `FetchContent_MakeAvailable` but passes EXCLUDE_FROM_ALL to `add_subdirectory`.
|
||||
macro(FetchContent_MakeAvailableExcludeFromAll)
|
||||
foreach(contentName IN ITEMS ${ARGV})
|
||||
string(TOLOWER ${contentName} contentNameLower)
|
||||
FetchContent_GetProperties(${contentName})
|
||||
if(NOT ${contentNameLower}_POPULATED)
|
||||
FetchContent_Populate(${contentName})
|
||||
if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
|
||||
add_subdirectory(${${contentNameLower}_SOURCE_DIR}
|
||||
${${contentNameLower}_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28.0")
|
||||
macro(FetchContent_Declare_ExcludeFromAll)
|
||||
FetchContent_Declare(${ARGV})
|
||||
endmacro()
|
||||
# Like `FetchContent_MakeAvailable` but passes EXCLUDE_FROM_ALL to `add_subdirectory`.
|
||||
macro(FetchContent_MakeAvailable_ExcludeFromAll)
|
||||
foreach(name ${ARGV})
|
||||
string(TOLOWER ${name} nameLower)
|
||||
FetchContent_GetProperties(${name})
|
||||
if(NOT ${${nameLower}_POPULATED})
|
||||
FetchContent_Populate(${name})
|
||||
if(EXISTS ${${nameLower}_SOURCE_DIR}/CMakeLists.txt)
|
||||
add_subdirectory(${${nameLower}_SOURCE_DIR} ${${nameLower}_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
endmacro()
|
||||
else()
|
||||
macro(FetchContent_Declare_ExcludeFromAll)
|
||||
FetchContent_Declare(${ARGV} EXCLUDE_FROM_ALL)
|
||||
endmacro()
|
||||
macro(FetchContent_MakeAvailable_ExcludeFromAll)
|
||||
FetchContent_MakeAvailable(${ARGV})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(NOT OPENMW_USE_SYSTEM_BULLET)
|
||||
|
||||
@ -47,12 +59,12 @@ if(NOT OPENMW_USE_SYSTEM_BULLET)
|
||||
|
||||
# May 7, 2021
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(bullet
|
||||
FetchContent_Declare_ExcludeFromAll(bullet
|
||||
URL https://github.com/bulletphysics/bullet3/archive/refs/tags/3.17.tar.gz
|
||||
URL_HASH SHA512=a5105bf5f1dd365a64a350755c7d2c97942f74897a18dcdb3651e6732fd55cc1030a096f5808cf50575281f05e3ac09aa50a48d271a47b94cd61f5167a72b7cc
|
||||
SOURCE_DIR fetched/bullet
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(bullet)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(bullet)
|
||||
|
||||
set(BULLET_INCLUDE_DIRS ${bullet_SOURCE_DIR}/src PARENT_SCOPE)
|
||||
|
||||
@ -77,12 +89,12 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(mygui
|
||||
FetchContent_Declare_ExcludeFromAll(mygui
|
||||
URL https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.3.zip
|
||||
URL_HASH SHA512=c804ef665e786076582367f171082cd2181fdbd214300ddcca4a4245c5a0f45e62e72778ee2d96ec46b393e22477dd729f9bb3006e6eecbf536674e34a057721
|
||||
SOURCE_DIR fetched/mygui
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(mygui)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(mygui)
|
||||
|
||||
set(MyGUI_INCLUDE_DIRS ${mygui_SOURCE_DIR}/MyGUIEngine/include PARENT_SCOPE)
|
||||
set(MyGUI_LIBRARIES MyGUIEngine PARENT_SCOPE)
|
||||
@ -143,12 +155,12 @@ if(NOT OPENMW_USE_SYSTEM_OSG)
|
||||
|
||||
# OSGoS branch 3.6
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(osg
|
||||
FetchContent_Declare_ExcludeFromAll(osg
|
||||
URL https://github.com/OpenMW/osg/archive/01cc2b585c8456a4ff843066b7e1a8715558289f.zip
|
||||
URL_HASH SHA512=9b0a94c1c1d99c767f1857629d43c7a53bfcb74ef760993a121567831e168a1ebbfc10b0c67d7f2241c7b6c6dab2d0e6b876d9f17aca0fabe1a8c86b2279f956
|
||||
SOURCE_DIR fetched/osg
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(osg)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(osg)
|
||||
|
||||
set(OPENSCENEGRAPH_INCLUDE_DIRS ${osg_SOURCE_DIR}/include ${osg_BINARY_DIR}/include PARENT_SCOPE)
|
||||
set(OSG_LIBRARIES OpenThreads osg PARENT_SCOPE)
|
||||
@ -174,22 +186,22 @@ if(NOT OPENMW_USE_SYSTEM_RECASTNAVIGATION)
|
||||
set(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "")
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(recastnavigation
|
||||
FetchContent_Declare_ExcludeFromAll(recastnavigation
|
||||
URL https://github.com/recastnavigation/recastnavigation/archive/c393777d26d2ff6519ac23612abf8af42678c9dd.zip
|
||||
URL_HASH SHA512=48f20cee7a70c2f20f4c68bb74d5af11a1434be85294e37f5fe7b7aae820fbcdff4f35d3be286eaf6f9cbce0aed4201fcc090df409a5bd04aec5fd7c29b3ad94
|
||||
SOURCE_DIR fetched/recastnavigation
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(recastnavigation)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(recastnavigation)
|
||||
endif()
|
||||
|
||||
if (NOT OPENMW_USE_SYSTEM_SQLITE3)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(sqlite3
|
||||
FetchContent_Declare_ExcludeFromAll(sqlite3
|
||||
URL https://www.sqlite.org/2023/sqlite-amalgamation-3410100.zip
|
||||
URL_HASH SHA512=7de291709e88fffc693cf24ac675950cfc35c1bf7631cfea95167105720a05cf37fb943c57c5c985db2eeaa57b31894b3c0df98a7bd2939b5746fc5a24b5ae87
|
||||
SOURCE_DIR fetched/sqlite3
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(sqlite3)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(sqlite3)
|
||||
|
||||
add_library(sqlite3 STATIC ${sqlite3_SOURCE_DIR}/sqlite3.c)
|
||||
target_include_directories(sqlite3 INTERFACE ${sqlite3_SOURCE_DIR}/)
|
||||
@ -212,12 +224,12 @@ if (BUILD_BENCHMARKS AND NOT OPENMW_USE_SYSTEM_BENCHMARK)
|
||||
set(BENCHMARK_ENABLE_WERROR OFF)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(benchmark
|
||||
FetchContent_Declare_ExcludeFromAll(benchmark
|
||||
URL https://github.com/google/benchmark/archive/refs/tags/v1.8.3.zip
|
||||
URL_HASH SHA512=d73587ad9c49338749e1d117a6f8c7ff9c603a91a2ffa91a7355c7df7dea82710b9a810d34ddfef20973ecdc77092ec10fb2b4e4cc8d2e7810cbed79617b3828
|
||||
SOURCE_DIR fetched/benchmark
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(benchmark)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(benchmark)
|
||||
endif()
|
||||
|
||||
if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
|
||||
@ -228,12 +240,12 @@ if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(yaml-cpp
|
||||
FetchContent_Declare_ExcludeFromAll(yaml-cpp
|
||||
URL https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7.0.zip
|
||||
URL_HASH MD5=1e8ca0d6ccf99f3ed9506c1f6937d0ec
|
||||
SOURCE_DIR fetched/yaml-cpp
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(yaml-cpp)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(yaml-cpp)
|
||||
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(yaml-cpp PRIVATE <algorithm>)
|
||||
@ -298,7 +310,7 @@ endif()
|
||||
if ((BUILD_COMPONENTS_TESTS OR BUILD_OPENCS_TESTS OR BUILD_OPENMW_TESTS) AND NOT OPENMW_USE_SYSTEM_GOOGLETEST)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(googletest
|
||||
FetchContent_Declare_ExcludeFromAll(googletest
|
||||
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
|
||||
URL_HASH SHA512=1479ea2f3172c622c0ca305f5b2bc45a42941221ec0ac7865e6d6d020ec4d008d952fc64e01a4c5138d7bed4148cf75596f25bb9e9044a98bbbf5662053ea11c
|
||||
SOURCE_DIR fetched/googletest
|
||||
@ -306,7 +318,7 @@ if ((BUILD_COMPONENTS_TESTS OR BUILD_OPENCS_TESTS OR BUILD_OPENMW_TESTS) AND NOT
|
||||
if (MSVC)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
FetchContent_MakeAvailableExcludeFromAll(googletest)
|
||||
FetchContent_MakeAvailable_ExcludeFromAll(googletest)
|
||||
|
||||
add_library(GTest::GTest ALIAS gtest)
|
||||
add_library(GMock::GMock ALIAS gmock)
|
||||
|
Loading…
x
Reference in New Issue
Block a user