Skip to content

Commit

Permalink
remove -fpermissive compiler flag
Browse files Browse the repository at this point in the history
Remove -fpermissive from the list of flags passed to gcc and clang.

Remove -fpermissive from the cxxflags from wxWidgets config as well.

When checking wxWidgets ABI compatibility version, temporarily add
-fpermissive to compiler flags on Win32 because minhook requires it.
  • Loading branch information
rkitover committed Aug 10, 2018
1 parent 571ecbe commit bfe21ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -427,7 +427,7 @@ 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)
set(MY_CXX_FLAGS -std=gnu++11 -fexceptions)

foreach(ARG ${MY_CXX_FLAGS})
set(MY_CXX_FLAGS_STR "${MY_CXX_FLAGS_STR} ${ARG}")
Expand Down
16 changes: 14 additions & 2 deletions src/wx/CMakeLists.txt
Expand Up @@ -65,6 +65,10 @@ function(normalize_wx_paths)
endif()
endfunction()

macro(cleanup_wx_vars)
list(REMOVE_ITEM wxWidgets_CXX_FLAGS -fpermissive)
endmacro()

if(CMAKE_PREFIX_PATH)
set(wxWidgets_CONFIG_OPTIONS "--prefix=${CMAKE_PREFIX_PATH}")
endif()
Expand All @@ -88,6 +92,7 @@ endif()
# do a compile test later
list(APPEND wxWidgets_USE_LIBS gl)
find_package(wxWidgets QUIET)
cleanup_wx_vars()
normalize_wx_paths()

SET(CHECK_WX_OPENGL FALSE)
Expand Down Expand Up @@ -153,8 +158,9 @@ ENDIF()
IF(NOT WX_HAS_OPENGL)
ADD_DEFINITIONS(-DNO_OGL)
LIST(REMOVE_ITEM wxWidgets_USE_LIBS gl)
FIND_PACKAGE(wxWidgets REQUIRED)
find_package(wxWidgets REQUIRED)
normalize_wx_paths()
cleanup_wx_vars()
ENDIF()

IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CROSSCOMPILING)
Expand Down Expand Up @@ -233,7 +239,9 @@ int main(int argc, char** argv)

# on windows we need the trampoline library from dependencies
IF(WIN32)
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -w -fpermissive "-I${CMAKE_SOURCE_DIR}/dependencies/minhook/include")
# minhook requires -fpermissive unfortunately
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -fpermissive)
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -fpermissive -w "-I${CMAKE_SOURCE_DIR}/dependencies/minhook/include")
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -Wl,--subsystem,console)

IF(AMD64)
Expand All @@ -245,6 +253,10 @@ int main(int argc, char** argv)

CHECK_CXX_SOURCE_RUNS("${WX_TEST_CONSOLE_APP}" WX_DEFAULT_ABI_VERSION_COMPATIBLE)

# remove -fpermissive set for minhook
list(REMOVE_ITEM CMAKE_REQUIRED_FLAGS -fpermissive)
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -fpermissive)

IF(NOT WX_DEFAULT_ABI_VERSION_COMPATIBLE)
# currently goes up to 11 with gcc7, but we give it some room
SET(WX_ABI_VERSION 15)
Expand Down

0 comments on commit bfe21ae

Please sign in to comment.