File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11
22# Specify .cpp files
3+ set (TARGET_NAME {{project_name }})
34set (SRC hello.cpp)
45
5- # Specify the executable
6- add_executable ({{project_name }}-bin main.cpp ${SRC} )
7- target_link_libraries ({{project_name }}-bin ${LIBRARIES} )
8- set_target_properties ({{project_name }}-bin PROPERTIES OUTPUT_NAME {{project_name }})
6+ # Build an executable from main.cpp and all specified source files
7+ add_executable (${TARGET_NAME} main.cpp ${SRC} )
8+ target_link_libraries (${TARGET_NAME} ${LIBRARIES} )
99
10- # Build a library
11- add_library ({{project_name }} ${SRC} )
12- target_link_libraries ({{project_name }} ${LIBRARIES} )
10+ # Build a library from all specified source files
11+ # This is required for using googletest
12+ add_library (${TARGET_NAME} -lib ${SRC} )
13+ target_link_libraries (${TARGET_NAME} -lib ${LIBRARIES} )
14+ set_target_properties (${TARGET_NAME} -lib PROPERTIES OUTPUT_NAME {{project_name }})
1315
1416# vim:ft=cmake
1517
Original file line number Diff line number Diff line change 11include (ExternalProject)
22
3- set (TARGET {{project_name }})
3+ set (TARGET {{project_name }}-lib )
44set (GTEST_TARGET ${TARGET} _test)
55file (GLOB_RECURSE TESTS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
66
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ void hello() {
99}
1010
1111std::string get_message () {
12+ // There's a mistake here
13+ // Try running `make check` and observe the failing test case
14+ // Then correct the line below and repeat
1215 return " Hellx, World!" ;
1316}
1417
You can’t perform that action at this time.
0 commit comments