Skip to content

Commit 63c5fcc

Browse files
committed
clean up cmake files
1 parent ddedf07 commit 63c5fcc

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

app/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1+
# Define executable and its properties
12
add_executable(${PROJECT_NAME} App.cpp)
2-
3-
# depends on CoreLibrary
4-
target_link_libraries(${PROJECT_NAME} PRIVATE CoreLibrary)
5-
6-
# set the output directory for the executable
3+
target_link_libraries(${PROJECT_NAME} PRIVATE Core)
74
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME})

library/CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
set(INCROOT ${PROJECT_SOURCE_DIR}/library/include/Core)
22
set(SRCROOT ${PROJECT_SOURCE_DIR}/library/src/Core)
33

4-
# all header files
4+
# Define header and source file lists
55
set(LIBRARY_HEADERS
66
${INCROOT}/Lib.hpp
77
)
88

9-
# all source files
109
set(LIBRARY_SOURCES
1110
${SRCROOT}/Lib.cpp
1211
)
1312

14-
# define library
15-
add_library(CoreLibrary STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES})
13+
# Define library and its properties
14+
add_library(Core STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES})
15+
target_include_directories(Core PUBLIC ${PROJECT_SOURCE_DIR}/library/include)
16+
target_compile_features(Core PUBLIC cxx_std_17)
1617

17-
# we need this directory, and users of our library will need it too
18-
target_include_directories(CoreLibrary PUBLIC ${PROJECT_SOURCE_DIR}/library/include)
19-
20-
# all users of this library will need at least C++17
21-
target_compile_features(CoreLibrary PUBLIC cxx_std_17)
22-
23-
# IDEs should put the headers and sources in a nice place
18+
# Group headers and sources for IDE
2419
source_group(TREE ${INCROOT} PREFIX "Headers" FILES ${LIBRARY_HEADERS})
2520
source_group(TREE ${SRCROOT} PREFIX "Sources" FILES ${LIBRARY_SOURCES})

0 commit comments

Comments
 (0)