From 45398453bee8deb4836c9346933a8499c6b01c33 Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Mon, 6 Apr 2020 23:50:46 -0400 Subject: [PATCH] First working cmake --- CMakeLists.txt | 20 ++++++++++++++++++++ conversions/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 conversions/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..f9557f12 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.0) +project(Algorithms_in_C + LANGUAGES C CXX + VERSION 1.0.0 + DESCRIPTION "Set of algorithms implemented in C." +) + +add_subdirectory(function_timer EXCLUDE_FROM_ALL) +include_directories(function_timer/include) +link_libraries(function_timer) +# include_directories(${CMAKE_BINARY_DIR}/include) +# link_directories(${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}) + +add_subdirectory(conversions) + +find_package(OpenMP) + +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +include(CPack) diff --git a/conversions/CMakeLists.txt b/conversions/CMakeLists.txt new file mode 100644 index 00000000..254a2f11 --- /dev/null +++ b/conversions/CMakeLists.txt @@ -0,0 +1,15 @@ +# 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} *.c ) +# 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 ".c" "" testname ${testsourcefile} ) + add_executable( ${testname} ${testsourcefile} ) + # Make sure YourLib is linked to each app + # target_link_libraries( ${testname} function_timer ) + install(TARGETS ${testname} DESTINATION "bin/conversions") + +endforeach( testsourcefile ${APP_SOURCES} )