mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Remove main.cpp and add warning free build test
The main.cpp speeds up builds but fails for static boost.Test builds as it is linked before Boost.Test which removes the required symbols Enabling warning allows consumers of Turtle to build with warnings enabled
This commit is contained in:
parent
1ed45af2de
commit
e13e913a1e
2 changed files with 17 additions and 13 deletions
|
|
@ -4,11 +4,25 @@
|
||||||
|
|
||||||
find_package(Boost 1.58 REQUIRED COMPONENTS unit_test_framework thread)
|
find_package(Boost 1.58 REQUIRED COMPONENTS unit_test_framework thread)
|
||||||
|
|
||||||
add_library(TurtleTestMain STATIC main.cpp)
|
add_library(TurtleTestMain INTERFACE)
|
||||||
target_link_libraries(TurtleTestMain PUBLIC Boost::unit_test_framework Boost::disable_autolinking)
|
target_link_libraries(TurtleTestMain INTERFACE Boost::unit_test_framework Boost::disable_autolinking)
|
||||||
|
target_compile_definitions(TurtleTestMain INTERFACE BOOST_AUTO_TEST_MAIN)
|
||||||
# Heuristically guess if we are compiling against dynamic boost
|
# Heuristically guess if we are compiling against dynamic boost
|
||||||
if(NOT Boost_USE_STATIC_LIBS AND Boost_UNIT_TEST_FRAMEWORK_LIBRARY AND NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}\$")
|
if(NOT Boost_USE_STATIC_LIBS AND Boost_UNIT_TEST_FRAMEWORK_LIBRARY AND NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}\$")
|
||||||
target_compile_definitions(TurtleTestMain PUBLIC BOOST_TEST_DYN_LINK)
|
target_compile_definitions(TurtleTestMain INTERFACE BOOST_TEST_DYN_LINK)
|
||||||
|
endif()
|
||||||
|
# Enable warnings
|
||||||
|
option(TURTLE_WERROR "Treat warnings as errors" ON)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
target_compile_options(TurtleTestMain INTERFACE -Wall -Wextra -pedantic -Wno-long-long)
|
||||||
|
if(TURTLE_WERROR)
|
||||||
|
target_compile_options(TurtleTestMain INTERFACE -Werror)
|
||||||
|
endif()
|
||||||
|
elseif(MSVC)
|
||||||
|
target_compile_options(TurtleTestMain INTERFACE /W4)
|
||||||
|
if(TURTLE_WERROR)
|
||||||
|
target_compile_options(TurtleTestMain INTERFACE /WX)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE testFiles test_*.cpp)
|
file(GLOB_RECURSE testFiles test_*.cpp)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
// http://turtle.sourceforge.net
|
|
||||||
//
|
|
||||||
// Copyright Mathieu Champlon 2009
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#define BOOST_AUTO_TEST_MAIN
|
|
||||||
#include <boost/test/auto_unit_test.hpp>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue