Skip to content

Commit 581dd22

Browse files
authored
chore: add math to CMake lists (#1236)
1 parent 9997c8b commit 581dd22

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ add_subdirectory(project_euler)
6363
add_subdirectory(machine_learning)
6464
add_subdirectory(process_scheduling_algorithms)
6565
add_subdirectory(numerical_methods)
66+
add_subdirectory(math)
6667

6768
## Configure Doxygen documentation system
6869
cmake_policy(SET CMP0054 NEW)

math/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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} *.c )
6+
foreach( testsourcefile ${APP_SOURCES} )
7+
string( REPLACE ".c" "" testname ${testsourcefile} ) # File type. Example: `.c`
8+
add_executable( ${testname} ${testsourcefile} )
9+
10+
if(OpenMP_C_FOUND)
11+
target_link_libraries(${testname} OpenMP::OpenMP_C)
12+
endif()
13+
if(MATH_LIBRARY)
14+
target_link_libraries(${testname} ${MATH_LIBRARY})
15+
endif()
16+
install(TARGETS ${testname} DESTINATION "bin/math") # Folder name. Do NOT include `<>`
17+
18+
endforeach( testsourcefile ${APP_SOURCES} )

0 commit comments

Comments
 (0)