-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
27 lines (23 loc) · 1.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cmake_minimum_required(VERSION 3.14) # b/c of FetchContent_MakeAvailable
project(CMakePPLang VERSION 1.0.0 LANGUAGES NONE)
# Testing defaults to OFF so project including CMakePPLang do not build
# its tests
option(BUILD_TESTING "Should we build and run the unit tests?" OFF)
# Adds CMakePPLang to the module path so it can be included as
# include(cmakepp_lang/cmakepp_lang), checks to make sure it hasn't been added
# before.
list(FIND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" path_has_cmake)
if(${path_has_cmake} STREQUAL "-1")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" CACHE STRING "" FORCE)
if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# For projects including CMakePPLang, add CMakePPLang to the module path
# for ease of use
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
endif()
# Toggle to build tests for CMakeLists
if("${BUILD_TESTING}")
include(CTest)
add_subdirectory(tests)
endif()