Merge branch 'bump-cmake-version' into 'master'

Bump required CMake version to 3.16

See merge request OpenMW/openmw!3242
revert-6246b479
psi29a 1 year ago
commit 9410eed9e5

@ -1,26 +1,7 @@
cmake_minimum_required(VERSION 3.1.0)
# for link time optimization, remove if cmake version is >= 3.9
if(POLICY CMP0069) # LTO
cmake_policy(SET CMP0069 NEW)
endif()
# for position-independent executable, remove if cmake version is >= 3.14
if(POLICY CMP0083)
cmake_policy(SET CMP0083 NEW)
endif()
# to link with freetype library
if(POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif()
# don't add /W3 flag by default for MSVC
if(POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()
cmake_minimum_required(VERSION 3.16.0)
# set the timestamps of extracted contents to the time of extraction
# remove if cmake version is >= 3.24
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
@ -585,20 +566,16 @@ if (NOT WIN32 AND NOT APPLE)
endif()
if(OPENMW_LTO_BUILD)
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
include(CheckIPOSupported)
check_ipo_supported(RESULT HAVE_IPO OUTPUT HAVE_IPO_OUTPUT)
if(HAVE_IPO)
message(STATUS "LTO enabled for Release configuration.")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
else()
message(WARNING "Requested option OPENMW_LTO_BUILD not supported by this compiler: ${HAVE_IPO_OUTPUT}")
if(MSVC)
message(STATUS "Note: Flags used to be set manually for this setting with MSVC. We now rely on CMake for this. Upgrade CMake to at least 3.13 to re-enable this setting.")
endif()
endif()
include(CheckIPOSupported)
check_ipo_supported(RESULT HAVE_IPO OUTPUT HAVE_IPO_OUTPUT)
if(HAVE_IPO)
message(STATUS "LTO enabled for Release configuration.")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
else()
message(WARNING "Requested option OPENMW_LTO_BUILD not supported by this cmake version: ${CMAKE_VERSION}. Upgrade CMake to at least 3.9 to enable support for certain compilers. Newer CMake versions support more compilers.")
message(WARNING "Requested option OPENMW_LTO_BUILD not supported by this compiler: ${HAVE_IPO_OUTPUT}")
if(MSVC)
message(STATUS "Note: Flags used to be set manually for this setting with MSVC. We now rely on CMake for this. Upgrade CMake to at least 3.13 to re-enable this setting.")
endif()
endif()
endif()

@ -5,7 +5,7 @@ if (UNIX AND NOT APPLE)
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT})
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
endif()

@ -5,7 +5,7 @@ if (UNIX AND NOT APPLE)
target_link_libraries(openmw_esm_refid_benchmark ${CMAKE_THREAD_LIBS_INIT})
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw_esm_refid_benchmark PRIVATE <algorithm>)
endif()

@ -8,7 +8,7 @@ if (UNIX AND NOT APPLE)
target_link_libraries(openmw_settings_access_benchmark ${CMAKE_THREAD_LIBS_INIT})
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw_settings_access_benchmark PRIVATE <algorithm>)
endif()

@ -18,7 +18,7 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(bsatool gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(bsatool PRIVATE
<filesystem>
<fstream>

@ -19,7 +19,7 @@ if (WIN32)
install(TARGETS openmw-bulletobjecttool RUNTIME DESTINATION ".")
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-bulletobjecttool PRIVATE
<string>
<vector>

@ -25,7 +25,7 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(esmtool gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(esmtool PRIVATE
<fstream>
<string>

@ -47,7 +47,7 @@ if (WIN32)
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
endif(WIN32)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-essimporter PRIVATE
<algorithm>
<filesystem>

@ -93,7 +93,7 @@ if(USE_QT)
set_property(TARGET openmw-launcher PROPERTY AUTOMOC ON)
endif(USE_QT)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-launcher PRIVATE
<boost/program_options/options_description.hpp>

@ -33,7 +33,7 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(openmw-iniimporter gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-iniimporter PRIVATE
<string>
<vector>

@ -21,7 +21,7 @@ if (WIN32)
install(TARGETS openmw-navmeshtool RUNTIME DESTINATION ".")
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-navmeshtool PRIVATE
<algorithm>
<memory>

@ -17,6 +17,6 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(niftest gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(niftest PRIVATE <filesystem>)
endif()

@ -290,7 +290,7 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(openmw-cs-lib gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-cs-lib PRIVATE
<boost/program_options/options_description.hpp>

@ -26,7 +26,7 @@ if (BUILD_WITH_CODE_COVERAGE)
target_link_libraries(openmw-cs-tests PRIVATE gcov)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw-cs-tests PRIVATE
<gtest/gtest.h>
)

@ -156,7 +156,7 @@ target_link_libraries(openmw
components
)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw PRIVATE
<boost/program_options/options_description.hpp>

@ -118,7 +118,7 @@ target_compile_definitions(openmw_test_suite
PRIVATE OPENMW_DATA_DIR=u8"${CMAKE_CURRENT_BINARY_DIR}/data"
OPENMW_PROJECT_SOURCE_DIR=u8"${PROJECT_SOURCE_DIR}")
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(openmw_test_suite PRIVATE
<boost/program_options/options_description.hpp>

@ -132,21 +132,16 @@ macro (openmw_add_executable target)
add_executable(${target} ${OMW_ADD_EXE_WIN32_VALUE} ${OMW_ADD_EXE_MACOSX_BUNDLE_VALUE} ${OMW_ADD_EXE_EXCLUDE_FROM_ALL_VALUE} ${OMW_ADD_EXE_UNPARSED_ARGUMENTS})
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
set_target_properties(${target} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:${target}>")
endif (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
set_target_properties(${target} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:${target}>")
endif (MSVC)
endmacro (openmw_add_executable)
macro (get_generator_is_multi_config VALUE)
# TODO: make git version getter less dumb so everywhere that calls this macro can just call the function this calls instead
if (DEFINED generator_is_multi_config_var)
set(${VALUE} ${generator_is_multi_config_var})
else (DEFINED generator_is_multi_config_var)
if (CMAKE_VERSION VERSION_GREATER 3.9 OR CMAKE_VERSION VERSION_EQUAL 3.9)
get_cmake_property(${VALUE} GENERATOR_IS_MULTI_CONFIG)
else (CMAKE_VERSION VERSION_GREATER 3.9 OR CMAKE_VERSION VERSION_EQUAL 3.9)
list(LENGTH CMAKE_CONFIGURATION_TYPES ${VALUE})
endif (CMAKE_VERSION VERSION_GREATER 3.9 OR CMAKE_VERSION VERSION_EQUAL 3.9)
get_cmake_property(${VALUE} GENERATOR_IS_MULTI_CONFIG)
endif (DEFINED generator_is_multi_config_var)
endmacro (get_generator_is_multi_config)

@ -614,7 +614,7 @@ if(USE_QT)
set_property(TARGET components_qt PROPERTY AUTOMOC ON)
endif(USE_QT)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(components PUBLIC
<sol/sol.hpp>

@ -1,6 +1,6 @@
add_library(Base64 INTERFACE)
target_include_directories(Base64 INTERFACE .)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(Base64 INTERFACE <string>)
endif()

@ -18,7 +18,6 @@ macro(FetchContent_MakeAvailableExcludeFromAll)
endmacro()
if(NOT OPENMW_USE_SYSTEM_BULLET)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(BUILD_BULLET3 OFF CACHE BOOL "")
set(BUILD_EXTRAS OFF CACHE BOOL "")
@ -63,7 +62,6 @@ if(NOT OPENMW_USE_SYSTEM_BULLET)
endif()
if(NOT OPENMW_USE_SYSTEM_MYGUI)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(MYGUI_RENDERSYSTEM 4 CACHE STRING "")
set(MYGUI_DISABLE_PLUGINS TRUE CACHE BOOL "")
@ -95,7 +93,6 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
endif()
if(NOT OPENMW_USE_SYSTEM_OSG)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(BUILD_OSG_APPLICATIONS OFF CACHE BOOL "")
set(BUILD_OSG_DEPRECATED_SERIALIZERS OFF CACHE BOOL "")
@ -213,7 +210,6 @@ endif()
add_subdirectory(smhasher)
if (BUILD_BENCHMARKS AND NOT OPENMW_USE_SYSTEM_BENCHMARK)
cmake_minimum_required(VERSION 3.11)
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
@ -243,7 +239,7 @@ if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
)
FetchContent_MakeAvailableExcludeFromAll(yaml-cpp)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(yaml-cpp PRIVATE <algorithm>)
endif()
endif()
@ -304,7 +300,6 @@ if (NOT OPENMW_USE_SYSTEM_ICU)
endif()
if ((BUILD_UNITTESTS OR BUILD_OPENCS_TESTS) AND NOT OPENMW_USE_SYSTEM_GOOGLETEST)
cmake_minimum_required(VERSION 3.11)
include(FetchContent)
FetchContent_Declare(googletest

@ -20,6 +20,6 @@ else()
target_link_libraries(oics local_tinyxml)
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(oics PUBLIC <algorithm> <string>)
endif()

@ -17,7 +17,7 @@ target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${OSG_LIBRARIES})
link_directories(${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
if (MSVC)
target_precompile_headers(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} PUBLIC
<memory>
<string>

Loading…
Cancel
Save