Skip to content

Commit 3b4d142

Browse files
authored
feat: add CMakeLists to the divide_and_conquer directory (TheAlgorithms#2072)
1 parent 969b447 commit 3b4d142

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
@@ -42,6 +42,7 @@ add_subdirectory(data_structures)
4242
add_subdirectory(machine_learning)
4343
add_subdirectory(numerical_methods)
4444
add_subdirectory(graph)
45+
add_subdirectory(divide_and_conquer)
4546

4647
cmake_policy(SET CMP0054 NEW)
4748
cmake_policy(SET CMP0057 NEW)

divide_and_conquer/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. RELATIVE may makes it easier to extract an executable name
3+
# automatically.
4+
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
5+
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6+
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7+
foreach( testsourcefile ${APP_SOURCES} )
8+
# I used a simple string replace, to cut off .cpp.
9+
string( REPLACE ".cpp" "" testname ${testsourcefile} )
10+
add_executable( ${testname} ${testsourcefile} )
11+
12+
set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX)
13+
if(OpenMP_CXX_FOUND)
14+
target_link_libraries(${testname} OpenMP::OpenMP_CXX)
15+
endif()
16+
install(TARGETS ${testname} DESTINATION "bin/divide_and_conquer")
17+
18+
endforeach( testsourcefile ${APP_SOURCES} )

0 commit comments

Comments
 (0)