pass all compiler/linker flags for compile test
When determining gcc/clang flags, save resulting C flags as MY_C_FLAGS, C++ flags as MY_CXX_FLAGS, and linker flags as MY_C_LINKER_FLAGS, then use them in the Wx OpenGL compile test. This fixes the test erroneously failing on git mxe on mac. Also, don't use -fPIC on Win32, set Wx defines separately from the test, and save all CMAKE_REQUIRED_* variables before the test and restore them afterwards.
This commit is contained in:
parent
78cd223827
commit
687c08a051
|
@ -317,7 +317,11 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
|||
ENDIF()
|
||||
|
||||
# common flags
|
||||
SET(MY_C_FLAGS -pipe -fPIC -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -feliminate-unused-debug-types)
|
||||
SET(MY_C_FLAGS -pipe -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -feliminate-unused-debug-types)
|
||||
|
||||
IF(NOT WIN32)
|
||||
SET(MY_C_FLAGS ${MY_C_FLAGS} -fPIC)
|
||||
ENDIF()
|
||||
|
||||
# check if SSP flags are supported
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
|
@ -347,21 +351,24 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
|||
ADD_COMPILE_OPTIONS(${C_COMPILE_FLAG})
|
||||
ENDFOREACH()
|
||||
|
||||
SET(MY_CXX_FLAGS -std=gnu++11 -fpermissive -fexceptions)
|
||||
|
||||
FOREACH(ARG ${MY_CXX_FLAGS})
|
||||
SET(MY_CXX_FLAGS_STR "${MY_CXX_FLAGS_STR} ${ARG}")
|
||||
ENDFOREACH()
|
||||
|
||||
# These must be set for C++ only, and we can't use generator expressions in
|
||||
# ADD_COMPILE_OPTIONS because that's a cmake 3.3 feature and we need 2.8.12
|
||||
# compat for Ubuntu 14.
|
||||
STRING(REGEX REPLACE "<FLAGS>" "<FLAGS> -std=gnu++11 -fpermissive -fexceptions " CMAKE_CXX_COMPILE_OBJECT ${CMAKE_CXX_COMPILE_OBJECT})
|
||||
|
||||
# make a string of compile options to add to link flags
|
||||
UNSET(C_COMPILE_FLAGS_STR)
|
||||
STRING(REGEX REPLACE "<FLAGS>" "<FLAGS> ${MY_CXX_FLAGS_STR} " CMAKE_CXX_COMPILE_OBJECT ${CMAKE_CXX_COMPILE_OBJECT})
|
||||
|
||||
FOREACH(ARG ${MY_C_FLAGS})
|
||||
SET(C_COMPILE_FLAGS_STR "${C_COMPILE_FLAGS_STR} ${ARG}")
|
||||
SET(MY_C_FLAGS_STR "${MY_C_FLAGS_STR} ${ARG}")
|
||||
ENDFOREACH()
|
||||
|
||||
# need all flags for linking, because of -flto etc.
|
||||
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${C_COMPILE_FLAGS_STR}")
|
||||
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${C_COMPILE_FLAGS_STR}")
|
||||
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${MY_C_FLAGS_STR}")
|
||||
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${MY_C_FLAGS_STR}")
|
||||
|
||||
# for the gcc -fstack-protector* flags we need libssp
|
||||
# we also have to use the gcc- binutils for LTO to work
|
||||
|
@ -377,13 +384,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
|||
FIND_PACKAGE(SSP)
|
||||
|
||||
IF(SSP_LIBRARY)
|
||||
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${SSP_LIBRARY}")
|
||||
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${SSP_LIBRARY}")
|
||||
SET(MY_C_LINKER_FLAGS ${MY_C_LINKER_FLAGS} ${SSP_LIBRARY})
|
||||
ENDIF(SSP_LIBRARY)
|
||||
|
||||
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} -Wl,-allow-multiple-definition")
|
||||
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,-allow-multiple-definition")
|
||||
SET(MY_C_LINKER_FLAGS ${MY_C_LINKER_FLAGS} -Wl,-allow-multiple-definition)
|
||||
ENDIF()
|
||||
|
||||
# set linker flags
|
||||
FOREACH(ARG ${MY_C_LINKER_FLAGS})
|
||||
SET(MY_C_LINKER_FLAGS_STR "${MY_C_LINKER_FLAGS_STR} ${ARG}")
|
||||
ENDFOREACH()
|
||||
|
||||
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${MY_C_LINKER_FLAGS_STR}")
|
||||
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${MY_C_LINKER_FLAGS_STR}")
|
||||
ENDIF()
|
||||
|
||||
# Assembler flags
|
||||
|
|
|
@ -2351,8 +2351,8 @@ msgstr ""
|
|||
#: ../src/wx/xrc/DisplayConfig.xrc:77 ../src/wx/xrc/DisplayConfig.xrc:221
|
||||
#: ../src/wx/xrc/DisplayConfig.xrc:270
|
||||
#: ../src/wx/xrc/GameBoyAdvanceConfig.xrc:32
|
||||
#: ../src/wx/xrc/GameBoyAdvanceConfig.xrc:183
|
||||
#: ../src/wx/xrc/SoundConfig.xrc:212 ../src/wx/xrc/SoundConfig.xrc:302
|
||||
#: ../src/wx/xrc/GameBoyAdvanceConfig.xrc:183 ../src/wx/xrc/SoundConfig.xrc:212
|
||||
#: ../src/wx/xrc/SoundConfig.xrc:302
|
||||
msgid "None"
|
||||
msgstr "Ningún"
|
||||
|
||||
|
|
|
@ -81,20 +81,26 @@ IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
ADD_DEFINITIONS(-DWXDEBUG)
|
||||
ENDIF()
|
||||
|
||||
FOREACH(DEF ${wxWidgets_DEFINITIONS})
|
||||
ADD_DEFINITIONS("-D${DEF}")
|
||||
ENDFOREACH()
|
||||
|
||||
# check if this build of wx actually has OpenGL support
|
||||
|
||||
SET(CURRENT_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${wxWidgets_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} -fPIC)
|
||||
SET(CURRENT_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CURRENT_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
SET(CURRENT_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
||||
SET(CURRENT_CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${MY_CXX_FLAGS} ${MY_C_FLAGS} ${MY_CXX_LINKER_FLAGS} ${MY_C_LINKER_FLAGS} ${CMAKE_REQUIRED_LIBRARIES} ${wxWidgets_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} ${MY_CXX_FLAGS} ${MY_C_FLAGS})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${wxWidgets_INCLUDE_DIRS})
|
||||
|
||||
FOREACH(DEF ${wxWidgets_DEFINITIONS})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} "-D${DEF}")
|
||||
ADD_DEFINITIONS("-D${DEF}")
|
||||
ENDFOREACH()
|
||||
|
||||
# CheckCXXSourceCompiles ignores compiler flags, so we have to stuff them into the definitions
|
||||
SET(CURRENT_CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${CMAKE_REQUIRED_FLAGS})
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
@ -115,6 +121,8 @@ IF(NOT WX_HAS_OPENGL)
|
|||
ENDIF()
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CURRENT_CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${CURRENT_CMAKE_REQUIRED_FLAGS})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${CURRENT_CMAKE_REQUIRED_INCLUDES})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${CURRENT_CMAKE_REQUIRED_DEFINITIONS})
|
||||
|
||||
# end of wx OpenGL check
|
||||
|
|
Loading…
Reference in New Issue