1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 22:15:35 +00:00

Eliminate redundant version checks

This commit is contained in:
AnyOldName3 2023-07-20 00:43:56 +01:00
parent c59904062f
commit 34fcfb63cf
22 changed files with 32 additions and 41 deletions

View file

@ -566,20 +566,16 @@ if (NOT WIN32 AND NOT APPLE)
endif() endif()
if(OPENMW_LTO_BUILD) if(OPENMW_LTO_BUILD)
if(NOT CMAKE_VERSION VERSION_LESS 3.9) include(CheckIPOSupported)
include(CheckIPOSupported) check_ipo_supported(RESULT HAVE_IPO OUTPUT HAVE_IPO_OUTPUT)
check_ipo_supported(RESULT HAVE_IPO OUTPUT HAVE_IPO_OUTPUT) if(HAVE_IPO)
if(HAVE_IPO) message(STATUS "LTO enabled for Release configuration.")
message(STATUS "LTO enabled for Release configuration.") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
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()
else() 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()
endif() endif()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -118,7 +118,7 @@ target_compile_definitions(openmw_test_suite
PRIVATE OPENMW_DATA_DIR=u8"${CMAKE_CURRENT_BINARY_DIR}/data" PRIVATE OPENMW_DATA_DIR=u8"${CMAKE_CURRENT_BINARY_DIR}/data"
OPENMW_PROJECT_SOURCE_DIR=u8"${PROJECT_SOURCE_DIR}") 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 target_precompile_headers(openmw_test_suite PRIVATE
<boost/program_options/options_description.hpp> <boost/program_options/options_description.hpp>

View file

@ -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}) 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 (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}>")
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)
endif (MSVC) endif (MSVC)
endmacro (openmw_add_executable) endmacro (openmw_add_executable)
macro (get_generator_is_multi_config VALUE) 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) if (DEFINED generator_is_multi_config_var)
set(${VALUE} ${generator_is_multi_config_var}) set(${VALUE} ${generator_is_multi_config_var})
else (DEFINED 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)
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)
endif (DEFINED generator_is_multi_config_var) endif (DEFINED generator_is_multi_config_var)
endmacro (get_generator_is_multi_config) endmacro (get_generator_is_multi_config)

View file

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

View file

@ -1,6 +1,6 @@
add_library(Base64 INTERFACE) add_library(Base64 INTERFACE)
target_include_directories(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>) target_precompile_headers(Base64 INTERFACE <string>)
endif() endif()

View file

@ -239,7 +239,7 @@ if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
) )
FetchContent_MakeAvailableExcludeFromAll(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>) target_precompile_headers(yaml-cpp PRIVATE <algorithm>)
endif() endif()
endif() endif()

View file

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

View file

@ -17,7 +17,7 @@ target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${OSG_LIBRARIES})
link_directories(${CMAKE_CURRENT_BINARY_DIR}) 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 target_precompile_headers(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} PUBLIC
<memory> <memory>
<string> <string>