File tree Expand file tree Collapse file tree 3 files changed +13
-27
lines changed Expand file tree Collapse file tree 3 files changed +13
-27
lines changed Original file line number Diff line number Diff line change 99)
1010
1111find_package (glad CONFIG REQUIRED)
12- find_package (SFML COMPONENTS system window graphics CONFIG REQUIRED)
12+ find_package (SFML COMPONENTS window CONFIG REQUIRED)
1313find_package (glm CONFIG REQUIRED)
1414
1515add_subdirectory (library)
Original file line number Diff line number Diff line change 1+ # Define executable and its properties
12add_executable (${PROJECT_NAME} App.cpp)
2-
3- # depends on CoreLibrary
4- target_link_libraries (${PROJECT_NAME} PRIVATE CoreLibrary)
5-
6- # depends on SFML
7- target_link_libraries (${PROJECT_NAME} PRIVATE sfml-system sfml-window)
8-
9- # set the output directory for the executable
3+ target_link_libraries (${PROJECT_NAME} PRIVATE Core)
4+ target_link_libraries (${PROJECT_NAME} PRIVATE sfml-window)
105set_target_properties (${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /${PROJECT_NAME} )
116
12- # copy resources directory after build
7+ # Copy resources directory after build
138add_custom_command (
149 TARGET ${PROJECT_NAME} POST_BUILD
1510 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR} /resources $<TARGET_FILE_DIR:${PROJECT_NAME} >/resources
Original file line number Diff line number Diff line change 11set (INCROOT ${PROJECT_SOURCE_DIR} /library/include /Core)
22set (SRCROOT ${PROJECT_SOURCE_DIR} /library/src/Core)
33
4- # all header files
4+ # Define header and source file lists
55set (LIBRARY_HEADERS
66 ${INCROOT} /Statics.hpp
77 ${INCROOT} /Camera.hpp
88 ${INCROOT} /Shader.hpp
99)
1010
11- # all source files
1211set (LIBRARY_SOURCES
1312 ${SRCROOT} /Statics.cpp
1413 ${SRCROOT} /Camera.cpp
1514 ${SRCROOT} /Shader.cpp
1615)
1716
18- # define library
19- add_library (CoreLibrary STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES} )
17+ # Define library and its properties
18+ add_library (Core STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES} )
19+ target_include_directories (Core PUBLIC ${PROJECT_SOURCE_DIR} /library/include )
20+ target_link_libraries (Core PUBLIC glad::glad)
21+ target_link_libraries (Core PUBLIC glm::glm)
22+ target_compile_features (Core PUBLIC cxx_std_17)
2023
21- # we need this directory, and users of our library will need it too
22- target_include_directories (CoreLibrary PUBLIC ${PROJECT_SOURCE_DIR} /library/include )
23-
24- # depends on glad
25- target_link_libraries (CoreLibrary PUBLIC glad::glad)
26-
27- # depends on glm
28- target_link_libraries (CoreLibrary PUBLIC glm::glm)
29-
30- # all users of this library will need at least C++17
31- target_compile_features (CoreLibrary PUBLIC cxx_std_17)
32-
33- # IDEs should put the headers and sources in a nice place
24+ # Group headers and sources for IDE
3425source_group (TREE ${INCROOT} PREFIX "Headers" FILES ${LIBRARY_HEADERS} )
3526source_group (TREE ${SRCROOT} PREFIX "Sources" FILES ${LIBRARY_SOURCES} )
You can’t perform that action at this time.
0 commit comments