From 3b4d1421d3f6ecc589290b3a2763c9a105f3b1a9 Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 28 Oct 2022 19:56:45 -0500 Subject: [PATCH] feat: add CMakeLists to the `divide_and_conquer` directory (#2072) --- CMakeLists.txt | 1 + divide_and_conquer/CMakeLists.txt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 divide_and_conquer/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a1cc76a07..3bbda35e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory(data_structures) add_subdirectory(machine_learning) add_subdirectory(numerical_methods) add_subdirectory(graph) +add_subdirectory(divide_and_conquer) cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0057 NEW) diff --git a/divide_and_conquer/CMakeLists.txt b/divide_and_conquer/CMakeLists.txt new file mode 100644 index 000000000..4d6204325 --- /dev/null +++ b/divide_and_conquer/CMakeLists.txt @@ -0,0 +1,18 @@ +# If necessary, use the RELATIVE flag, otherwise each source file may be listed +# with full pathname. RELATIVE may makes it easier to extract an executable name +# automatically. +file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) +# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) +foreach( testsourcefile ${APP_SOURCES} ) + # I used a simple string replace, to cut off .cpp. + string( REPLACE ".cpp" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + + set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX) + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/divide_and_conquer") + +endforeach( testsourcefile ${APP_SOURCES} )