File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.28)
2
+ project (Propulsion_2024)
3
+
4
+ set (CMAKE_CXX_STANDARD 14)
5
+ add_compile_options ("-g" )
6
+
7
+ # Optional mocking flag
8
+ option (MOCK_RPI "Use mock WiringPi" OFF )
9
+
10
+ # Include paths
11
+ include_directories (
12
+ ${PROJECT_SOURCE_DIR} /lib
13
+ ${PROJECT_SOURCE_DIR} /testing
14
+ )
15
+
16
+ # Enable GTest
17
+ include (FetchContent)
18
+ FetchContent_Declare(
19
+ googletest
20
+ URL https://github.com/google/googletest/archive/d144031940543e15423a25ae5a8a74141044862f.zip
21
+ )
22
+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
23
+ FetchContent_MakeAvailable(googletest)
24
+
25
+ enable_testing ()
26
+
27
+ # Define test target
28
+ add_executable (propulsion_test
29
+ testing/Command_Interpreter_Testing.cpp
30
+ lib/Command .h
31
+ lib/Command_Interpreter.cpp
32
+ lib/Command_Interpreter.h
33
+ lib/Wiring.cpp
34
+ lib/Wiring.h
35
+ )
36
+
37
+ # Always link GTest
38
+ target_link_libraries (propulsion_test GTest::gtest_main)
39
+
40
+ # Define mock or real behavior
41
+ if (MOCK_RPI)
42
+ message (STATUS "Building with MOCK_RPI=ON: Using mock WiringPi (no external linkage)." )
43
+ target_compile_definitions (propulsion_test PRIVATE MOCK_RPI)
44
+ else ()
45
+ message (STATUS "Building with MOCK_RPI=OFF: Linking to real WiringPi." )
46
+ target_link_libraries (propulsion_test wiringPi)
47
+ endif ()
48
+
49
+ include (GoogleTest)
50
+ gtest_discover_tests(propulsion_test)
You can’t perform that action at this time.
0 commit comments