mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
added cmake to math, others and compu_stats
This commit is contained in:
parent
a0208cffc3
commit
9c0025aa3d
@ -1,10 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(Algorithms_in_C
|
||||
LANGUAGES C CXX
|
||||
project(Algorithms_in_C++
|
||||
LANGUAGES CXX
|
||||
VERSION 1.0.0
|
||||
DESCRIPTION "Set of algorithms implemented in C."
|
||||
)
|
||||
|
||||
# set(CMAKE_CXX_CPPLINT "~/anaconda3/bin/cpplint --filter=-legal/copyright --std=c++11")
|
||||
# find_program(CLANG_FORMAT "clang-format")
|
||||
|
||||
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
|
||||
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
@ -34,32 +37,17 @@ if(DOXYGEN_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
function(function_timer)
|
||||
set(CMAKE_BUILD_TYPE "Release") # This is local to function
|
||||
add_subdirectory(function_timer EXCLUDE_FROM_ALL)
|
||||
endfunction()
|
||||
|
||||
function_timer()
|
||||
|
||||
include_directories(function_timer/include)
|
||||
# link_libraries(function_timer)
|
||||
# include_directories(${CMAKE_BINARY_DIR}/include)
|
||||
# link_directories(${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
add_compile_options(/Za)
|
||||
endif(MSVC)
|
||||
|
||||
add_subdirectory(conversions)
|
||||
add_subdirectory(misc)
|
||||
add_subdirectory(project_euler)
|
||||
add_subdirectory(sorting)
|
||||
add_subdirectory(searching)
|
||||
add_subdirectory(numerical_methods)
|
||||
add_subdirectory(math)
|
||||
add_subdirectory(others)
|
||||
add_subdirectory(computer_oriented_statistical_methods)
|
||||
|
||||
if(USE_OPENMP)
|
||||
find_package(OpenMP)
|
||||
|
18
computer_oriented_statistical_methods/CMakeLists.txt
Normal file
18
computer_oriented_statistical_methods/CMakeLists.txt
Normal file
@ -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/stats")
|
||||
|
||||
endforeach( testsourcefile ${APP_SOURCES} )
|
18
math/CMakeLists.txt
Normal file
18
math/CMakeLists.txt
Normal file
@ -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/math")
|
||||
|
||||
endforeach( testsourcefile ${APP_SOURCES} )
|
18
others/CMakeLists.txt
Normal file
18
others/CMakeLists.txt
Normal file
@ -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/others")
|
||||
|
||||
endforeach( testsourcefile ${APP_SOURCES} )
|
Loading…
Reference in New Issue
Block a user