Update CMakeLists.txt

pull/3478/head
Kim Kulling 2020-10-27 09:23:20 +01:00 committed by GitHub
parent 7e1a8f09c5
commit 4bba338d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 21 deletions

View File

@ -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 ( OPENDDL_PARSER_VERSION ${OPENDDL_PARSER_VERSION_MAJOR}.${OPENDDL_PARSER_VERSION_MINOR}.${OPENDDL_PARSER_VERSION_PATCH} )
SET ( PROJECT_VERSION "${OPENDDL_PARSER_VERSION}" ) SET ( PROJECT_VERSION "${OPENDDL_PARSER_VERSION}" )
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_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( DDL_STATIC_LIBRARY "Set to ON to build static libary of OpenDDL Parser." ON )
option( COVERALLS "Generate coveralls data" OFF ) option( COVERALLS "Generate coveralls data" OFF )
set(CMAKE_CXX_STANDARD 11) if ( DDL_USE_CPP11 )
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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 ) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
find_package(Threads) find_package(Threads)
@ -23,11 +31,6 @@ if ( DDL_STATIC_LIBRARY )
add_definitions( -DOPENDDL_STATIC_LIBARY ) add_definitions( -DOPENDDL_STATIC_LIBARY )
endif() 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( -DOPENDDLPARSER_BUILD )
add_definitions( -D_VARIADIC_MAX=10 ) add_definitions( -D_VARIADIC_MAX=10 )
add_definitions( -DGTEST_HAS_PTHREAD=0 ) add_definitions( -DGTEST_HAS_PTHREAD=0 )
@ -46,7 +49,7 @@ link_directories(
${CMAKE_HOME_DIRECTORY}/lib ${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_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin )
@ -94,20 +97,15 @@ SET ( openddl_parser_src
include/openddlparser/OpenDDLStream.h include/openddlparser/OpenDDLStream.h
include/openddlparser/DDLNode.h include/openddlparser/DDLNode.h
include/openddlparser/Value.h include/openddlparser/Value.h
include/openddlparser/TPoolAllocator.h
README.md README.md
) )
SOURCE_GROUP( code FILES ${openddl_parser_src} ) SOURCE_GROUP( code FILES ${openddl_parser_src} )
if ( DDL_STATIC_LIBRARY ) if ( DDL_STATIC_LIBRARY )
ADD_LIBRARY( openddl_parser STATIC ADD_LIBRARY( openddl_parser STATIC ${openddl_parser_src} )
${openddl_parser_src}
)
else() else()
ADD_LIBRARY( openddl_parser SHARED ADD_LIBRARY( openddl_parser SHARED ${openddl_parser_src} )
${openddl_parser_src}
)
endif() endif()
SET ( GTEST_PATH contrib/gtest-1.7.0 ) 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-test-part.cc
${GTEST_PATH}/src/gtest-typed-test.cc ${GTEST_PATH}/src/gtest-typed-test.cc
${GTEST_PATH}/src/gtest.cc ${GTEST_PATH}/src/gtest.cc
${GTEST_PATH}/src/gtest_main.cc
) )
SET( openddl_parser_unittest_src SET( openddl_parser_unittest_src
@ -134,10 +133,7 @@ SET( openddl_parser_unittest_src
test/OpenDDLIntegrationTest.cpp test/OpenDDLIntegrationTest.cpp
test/ValueTest.cpp test/ValueTest.cpp
test/OpenDDLDefectsTest.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( code FILES ${openddl_parser_unittest_src} )
SOURCE_GROUP( gtest FILES ${gtest_src} ) SOURCE_GROUP( gtest FILES ${gtest_src} )