mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 22:15:34 +00:00
Eliminate redundant version checks
This commit is contained in:
parent
c59904062f
commit
34fcfb63cf
22 changed files with 32 additions and 41 deletions
|
@ -566,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>
|
||||
|
||||
|
|
2
extern/Base64/CMakeLists.txt
vendored
2
extern/Base64/CMakeLists.txt
vendored
|
@ -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()
|
||||
|
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -239,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()
|
||||
|
|
2
extern/oics/CMakeLists.txt
vendored
2
extern/oics/CMakeLists.txt
vendored
|
@ -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()
|
||||
|
|
2
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
2
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
|
@ -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…
Reference in a new issue