forked from teamnwah/openmw-tes3coop
Use builtin compiler version in CMake scripts
This commit is contained in:
parent
64fdc5a21a
commit
a6b67154bb
1 changed files with 14 additions and 19 deletions
|
@ -141,11 +141,11 @@ if (USE_QT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_QT AND DESIRED_QT_VERSION MATCHES 5)
|
if (USE_QT AND DESIRED_QT_VERSION MATCHES 5)
|
||||||
# 2.8.11+ is required to make Qt5 happy and allow linking QtMain on Windows.
|
# 2.8.11+ is required to make Qt5 happy and allow linking QtMain on Windows.
|
||||||
cmake_minimum_required(VERSION 2.8.11)
|
cmake_minimum_required(VERSION 2.8.11)
|
||||||
else()
|
else()
|
||||||
# We probably support older versions than this.
|
# We probably support older versions than this.
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Sound setup
|
# Sound setup
|
||||||
|
@ -246,12 +246,6 @@ if(OSG_STATIC)
|
||||||
set(OPENSCENEGRAPH_LIBRARIES ${OPENSCENEGRAPH_LIBRARIES} ${${PLUGIN_NAME}_LIBRARY})
|
set(OPENSCENEGRAPH_LIBRARIES ${OPENSCENEGRAPH_LIBRARIES} ${${PLUGIN_NAME}_LIBRARY})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(use_static_osg_plugin_dep DEPENDENCY)
|
|
||||||
find_package(${DEPENDENCY} REQUIRED)
|
|
||||||
|
|
||||||
set(OPENSCENEGRAPH_LIBRARIES ${OPENSCENEGRAPH_LIBRARIES} ${${DEPENDENCY}_LIBRARIES})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
add_definitions(-DOSG_LIBRARY_STATIC)
|
add_definitions(-DOSG_LIBRARY_STATIC)
|
||||||
|
|
||||||
set(PLUGIN_LIST
|
set(PLUGIN_LIST
|
||||||
|
@ -272,6 +266,11 @@ if(OSG_STATIC)
|
||||||
JPEG # needed by osgdb_jpeg
|
JPEG # needed by osgdb_jpeg
|
||||||
)
|
)
|
||||||
|
|
||||||
|
macro(use_static_osg_plugin_dep DEPENDENCY)
|
||||||
|
find_package(${DEPENDENCY} REQUIRED)
|
||||||
|
|
||||||
|
set(OPENSCENEGRAPH_LIBRARIES ${OPENSCENEGRAPH_LIBRARIES} ${${DEPENDENCY}_LIBRARIES})
|
||||||
|
endmacro()
|
||||||
foreach(DEPENDENCY ${PLUGIN_DEPS_LIST})
|
foreach(DEPENDENCY ${PLUGIN_DEPS_LIST})
|
||||||
use_static_osg_plugin_dep(${DEPENDENCY})
|
use_static_osg_plugin_dep(${DEPENDENCY})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -376,18 +375,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long")
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE)
|
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE)
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE CLANG_VERSION)
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6)
|
||||||
string(REGEX REPLACE ".*version ([0-9\\.]*).*" "\\1" CLANG_VERSION ${CLANG_VERSION})
|
|
||||||
if ("${CLANG_VERSION}" VERSION_GREATER 3.6 OR "${CLANG_VERSION}" VERSION_EQUAL 3.6)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression")
|
||||||
endif ("${CLANG_VERSION}" VERSION_GREATER 3.6 OR "${CLANG_VERSION}" VERSION_EQUAL 3.6)
|
endif ()
|
||||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE)
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.6)
|
||||||
OUTPUT_VARIABLE GCC_VERSION)
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter")
|
||||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
endif()
|
||||||
elseif (MSVC)
|
elseif (MSVC)
|
||||||
# Enable link-time code generation globally for all linking
|
# Enable link-time code generation globally for all linking
|
||||||
if (OPENMW_LTO_BUILD)
|
if (OPENMW_LTO_BUILD)
|
||||||
|
|
Loading…
Reference in a new issue