Skip to content

Commit 1a6ca12

Browse files
authored
feat: add physics to CMake lists (#2481)
1 parent 0953376 commit 1a6ca12

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ add_subdirectory(graph)
4545
add_subdirectory(divide_and_conquer)
4646
add_subdirectory(games)
4747
add_subdirectory(cpu_scheduling_algorithms)
48+
add_subdirectory(physics)
4849

4950
cmake_policy(SET CMP0054 NEW)
5051
cmake_policy(SET CMP0057 NEW)

physics/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2+
# with full pathname. The RELATIVE flag makes it easier to extract an executable's name
3+
# automatically.
4+
5+
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
6+
foreach( testsourcefile ${APP_SOURCES} )
7+
string( REPLACE ".cpp" "" testname ${testsourcefile} ) # File type. Example: `.cpp`
8+
add_executable( ${testname} ${testsourcefile} )
9+
10+
set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX)
11+
if(OpenMP_CXX_FOUND)
12+
target_link_libraries(${testname} OpenMP::OpenMP_CXX)
13+
endif()
14+
install(TARGETS ${testname} DESTINATION "bin/physics") # Folder name. Do NOT include `<>`
15+
16+
endforeach( testsourcefile ${APP_SOURCES} )

0 commit comments

Comments
 (0)