From 69d51127a0031411d2271657b245ceb59ffd84e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Fri, 28 Oct 2016 20:25:43 +0200 Subject: [PATCH] CMakeLists.txt now uses manualtest.cpp if Google Test was not found --- CMakeLists.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59106b5..3734daa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,16 +2,24 @@ cmake_minimum_required(VERSION 3.6) project(cpp11NHF1_refcountedString) set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-unused-comparison") -find_package (Threads REQUIRED) -link_libraries(${CMAKE_THREAD_LIBS_INIT}) +set(STRING_FILES String.cpp String.h StringValue.cpp StringValue.h Char.cpp Char.h) +set(UNIT_SOURCE_FILES ${STRING_FILES} test.cpp) +set(MANUAL_SOURCE_FILES ${STRING_FILES} manualtest.cpp) include(FindGTest) enable_testing() -find_package(GTest REQUIRED) -include_directories(${GTEST_INCLUDE_DIRS}) -link_libraries(${GTEST_BOTH_LIBRARIES}) +find_package(GTest) + +if(GTEST_FOUND) + find_package(Threads REQUIRED) + link_libraries(${CMAKE_THREAD_LIBS_INIT}) + include_directories(${GTEST_INCLUDE_DIRS}) + link_libraries(${GTEST_BOTH_LIBRARIES}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments") + add_executable(cpp11NHF1_refcountedString ${UNIT_SOURCE_FILES}) +else(GTEST_FOUND) + add_executable(cpp11NHF1_refcountedString ${MANUAL_SOURCE_FILES}) +endif(GTEST_FOUND) -set(SOURCE_FILES String.cpp String.h StringValue.cpp StringValue.h Char.cpp Char.h test.cpp) -add_executable(cpp11NHF1_refcountedString ${SOURCE_FILES}) \ No newline at end of file