mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
First working cmake
This commit is contained in:
parent
772dd98aa6
commit
45398453be
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal 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)
|
15
conversions/CMakeLists.txt
Normal file
15
conversions/CMakeLists.txt
Normal 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} )
|
Loading…
Reference in New Issue
Block a user