First working cmake

This commit is contained in:
Krishna Vedala 2020-04-06 23:50:46 -04:00
parent 772dd98aa6
commit 45398453be
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
2 changed files with 35 additions and 0 deletions

20
CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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} )