From 42f6c446ea84505d8f7c6f2e8587d3c0fe7fc666 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Fri, 8 Sep 2017 08:59:19 -0700 Subject: [PATCH] minor improvements for Wx compile tests Include `wx/wxprec.h` (precompiled header first in test programs to possibly make the tests slightly faster. For the ABI compat check, set a variable for the test program instead of listing it twice. --- src/wx/CMakeLists.txt | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 081f4448..6282cfa3 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -93,6 +93,7 @@ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_FLAGS} ${CMAKE_REQUIRED_DEFINITI INCLUDE(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES(" +#include #include #include @@ -110,8 +111,9 @@ ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) INCLUDE(CheckCXXSourceRuns) - CHECK_CXX_SOURCE_RUNS(" + SET(WX_TEST_CONSOLE_APP " #include +#include #include class MyApp : public wxAppConsole { @@ -124,7 +126,9 @@ bool MyApp::OnInit() { } wxIMPLEMENT_APP(MyApp); -" WX_DEFAULT_ABI_VERSION_COMPATIBLE) +") + + CHECK_CXX_SOURCE_RUNS("${WX_TEST_CONSOLE_APP}" WX_DEFAULT_ABI_VERSION_COMPATIBLE) IF(NOT WX_DEFAULT_ABI_VERSION_COMPATIBLE) # currently goes up to 11 with gcc7, but we give it some room @@ -139,21 +143,7 @@ wxIMPLEMENT_APP(MyApp); SET(WX_ABI_VAR "WX_ABI_VERSION_${WX_ABI_VERSION}") - CHECK_CXX_SOURCE_RUNS(" -#include -#include - -class MyApp : public wxAppConsole { -public: - virtual bool OnInit(); -}; - -bool MyApp::OnInit() { - exit(0); -} - -wxIMPLEMENT_APP(MyApp); - " ${WX_ABI_VAR}) + CHECK_CXX_SOURCE_RUNS("${WX_TEST_CONSOLE_APP}" ${WX_ABI_VAR}) IF(${${WX_ABI_VAR}}) BREAK()