From 4bba338d92823f4180fe02d54da7d39ce713cfaf Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 27 Oct 2020 09:23:20 +0100 Subject: [PATCH] Update CMakeLists.txt --- contrib/CMakeLists.txt | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 6a38acf5f..619b1e5b4 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -6,12 +6,20 @@ SET ( OPENDDL_PARSER_VERSION_PATCH 0 ) SET ( OPENDDL_PARSER_VERSION ${OPENDDL_PARSER_VERSION_MAJOR}.${OPENDDL_PARSER_VERSION_MINOR}.${OPENDDL_PARSER_VERSION_PATCH} ) SET ( PROJECT_VERSION "${OPENDDL_PARSER_VERSION}" ) -option( DDL_DEBUG_OUTPUT "Set to ON to use output debug texts" OFF ) -option( DDL_STATIC_LIBRARY "Set to ON to build static libary of OpenDDL Parser." ON ) -option( COVERALLS "Generate coveralls data" OFF ) +option( DDL_USE_CPP11 "Set to ON to use C++11 features ( always on on windows )." ON ) +option( DDL_DEBUG_OUTPUT "Set to ON to use output debug texts" OFF ) +option( DDL_STATIC_LIBRARY "Set to ON to build static libary of OpenDDL Parser." ON ) +option( COVERALLS "Generate coveralls data" OFF ) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +if ( DDL_USE_CPP11 ) + if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) + set( OPENDDL_CXXFLAGS -std=c++0x ) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set( OPENDDL_CXXFLAGS --std=c++11 ) + endif() +else( DDL_USE_CPP11 ) + add_definitions( -DOPENDDL_NO_USE_CPP11 ) +endif( DDL_USE_CPP11) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) find_package(Threads) @@ -23,11 +31,6 @@ if ( DDL_STATIC_LIBRARY ) add_definitions( -DOPENDDL_STATIC_LIBARY ) endif() -if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING") - add_definitions(-DGTEST_HAS_TR1_TUPLE=0) -endif() - add_definitions( -DOPENDDLPARSER_BUILD ) add_definitions( -D_VARIADIC_MAX=10 ) add_definitions( -DGTEST_HAS_PTHREAD=0 ) @@ -46,7 +49,7 @@ link_directories( ${CMAKE_HOME_DIRECTORY}/lib ) -SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ) +set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin ) @@ -94,20 +97,15 @@ SET ( openddl_parser_src include/openddlparser/OpenDDLStream.h include/openddlparser/DDLNode.h include/openddlparser/Value.h - include/openddlparser/TPoolAllocator.h README.md ) SOURCE_GROUP( code FILES ${openddl_parser_src} ) if ( DDL_STATIC_LIBRARY ) - ADD_LIBRARY( openddl_parser STATIC - ${openddl_parser_src} - ) + ADD_LIBRARY( openddl_parser STATIC ${openddl_parser_src} ) else() - ADD_LIBRARY( openddl_parser SHARED - ${openddl_parser_src} - ) + ADD_LIBRARY( openddl_parser SHARED ${openddl_parser_src} ) endif() SET ( GTEST_PATH contrib/gtest-1.7.0 ) @@ -121,6 +119,7 @@ SET ( gtest_src ${GTEST_PATH}/src/gtest-test-part.cc ${GTEST_PATH}/src/gtest-typed-test.cc ${GTEST_PATH}/src/gtest.cc + ${GTEST_PATH}/src/gtest_main.cc ) SET( openddl_parser_unittest_src @@ -134,10 +133,7 @@ SET( openddl_parser_unittest_src test/OpenDDLIntegrationTest.cpp test/ValueTest.cpp test/OpenDDLDefectsTest.cpp - test/OssFuzzTest.cpp - test/main.cpp ) -add_definitions(-DOPENDDL_TEST_DATA="${CMAKE_CURRENT_LIST_DIR}/test/TestData") SOURCE_GROUP( code FILES ${openddl_parser_unittest_src} ) SOURCE_GROUP( gtest FILES ${gtest_src} )