-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (73 loc) · 3.36 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright (c) 2023 Murex
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19.3)
project(Kata-MarsRover CXX)
set(CMAKE_CXX_STANDARD 20)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++20")
endif()
enable_testing()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Where to place compiled static libraries.")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Where to place compiled shared libraries.")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Where to place compiled executables.")
# We use CPM for 3rd-party dependencies management
include(cmake/CPM.cmake)
include(cmake/FindGoogleTest.cmake)
add_library(Kata-MarsRover-shared SHARED)
target_compile_definitions(Kata-MarsRover-shared PRIVATE MARS_ROVER_EXPORTS)
target_sources(Kata-MarsRover-shared
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/kata/mars_rover/MarsRover.cpp
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/kata/mars_rover/MarsRover.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/kata/mars_rover/config.hpp
)
target_include_directories(Kata-MarsRover-shared
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
add_executable(Kata-MarsRover-test)
target_sources(Kata-MarsRover-test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test/MarsRoverTest.cpp
)
target_link_libraries(Kata-MarsRover-test
PRIVATE
Kata-MarsRover-shared
gtest_main)
add_test(
NAME ctest-Kata-MarsRover
COMMAND Kata-MarsRover-test --gtest_brief=1 --gtest_output=xml:test-results/Kata-MarsRover-test.xml
)
add_custom_target(Docs
SOURCES
../README.md
./GETTING_STARTED.md
../QuickRetrospective.md)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Kata-MarsRover-test)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY XCODE_STARTUP_PROJECT Kata-MarsRover-test)
set_property(TARGET Kata-MarsRover-shared PROPERTY FOLDER "Kata")
set_property(TARGET Kata-MarsRover-test PROPERTY FOLDER "Kata")
set_property(TARGET Docs PROPERTY FOLDER "Kata")
set_property(TARGET gtest gtest_main PROPERTY FOLDER "Third-Party/GoogleTest")
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Generated")