Skip to content

Commit b646d41

Browse files
author
Zach Rammell
authored
CMake: Move tests behind config option (#49)
1 parent a700230 commit b646d41

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4)
1+
cmake_minimum_required(VERSION 3.5)
22
enable_testing()
33

44
project(cppparser VERSION 1.0.0)
@@ -14,6 +14,8 @@ if(MSVC)
1414
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd\"4996\"")
1515
endif()
1616

17+
option(CPPPARSER_BUILD_TESTS "Build tests" OFF)
18+
1719
add_subdirectory(cppast)
1820
add_subdirectory(cppparser)
1921
add_subdirectory(cppwriter)

cppast/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ target_include_directories(cppast
2020
)
2121
set_target_properties(cppast PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
2222

23-
add_subdirectory(test)
23+
if (CPPPARSER_BUILD_TESTS)
24+
add_subdirectory(test)
25+
endif()
2426

2527
install(DIRECTORY "include/cppast" DESTINATION "include")

cppparser/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ if(MSVC)
33
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd\"4996\"")
44
endif()
55

6-
add_subdirectory(test)
76
add_subdirectory(third_party/btyacc_tp)
87

9-
add_definitions(-DBOOST_AUTO_LINK_NOMANGLE)
8+
if (CPPPARSER_BUILD_TESTS)
9+
add_subdirectory(test)
1010

11-
add_subdirectory(../../common/third_party/boost_tp/cmake ${CMAKE_BINARY_DIR}/boost)
11+
add_definitions(-DBOOST_AUTO_LINK_NOMANGLE)
1212

13-
include_directories(../../common/third_party)
13+
add_subdirectory(../../common/third_party/boost_tp/cmake ${CMAKE_BINARY_DIR}/boost)
14+
15+
include_directories(../../common/third_party)
16+
endif()
1417

1518
#############################################
1619
## CppParser

0 commit comments

Comments
 (0)