-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
79 lines (62 loc) · 2.17 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
## Konfiguration des Buildsystems CMake ##
# Minimale Version des Buildsystems
cmake_minimum_required(VERSION 3.14)
# Name des Projekts
project(Hangman)
## Optionen ##
# Setzte verwendeten C++-Standard auf C++17
# Prüfe ob Heapspeicher gefunden wird,
# der nicht freigegeben wurde
# add_compile_options(-fsanitize=address)
# add_link_options(-fsanitize=address)
# Füge selbsgeschriebene Includes hinzu
include_directories(include)
# Füge externe Includes hinzu
include_directories(external)
set(PYTHON_LIBRARY "external/python3.lib")
find_package(pybind11 REQUIRED)
## Baue Programme ##
# Baue das Programm 'demo1' aus den genannten Quelldateien
file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_executable(demo1
examples/demo1.cpp
${SRC_FILES}
)
pybind11_add_module(battleship
examples/pybind_battleship.cpp
${SRC_FILES}
)
## Installiere die Bibliothek
install(TARGETS battleship
COMPONENT python
LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/extra")
#----------------------------------------------#
#----------Download and use GoogleTest---------#
#----------------------------------------------#
# Use CMakes FetchContent
#include(FetchContent)
# Workaround for CMake >= 3.24
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP
#if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
# cmake_policy(SET CMP0135 NEW)
#endif()
# Download GoogleTest (we use version 1.12.1)
#FetchContent_Declare(
# googletest
# URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
#)
# Workaround for Windows:
# Prevent overriding the parent project's compiler/linker settings
#set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Include CMake configuration of GoogleTest
#FetchContent_MakeAvailable(googletest)
#include(GoogleTest)
# Enable GoogleTest
#enable_testing()
#----------------------------------------------#
#-------------Erzeuge Testprogramme------------#
#----------------------------------------------#
# Declare test program battleship_board_tests
#add_executable(battleship_board_tests tests/battleship_board_tests.cpp ${SRC_FILES})
#target_link_libraries(battleship_board_tests GTest::gtest_main)
#gtest_discover_tests(battleship_board_tests)