2020-05-23 08:32:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2020-04-07 11:50:46 +08:00
|
|
|
project(Algorithms_in_C
|
|
|
|
LANGUAGES C CXX
|
|
|
|
VERSION 1.0.0
|
|
|
|
DESCRIPTION "Set of algorithms implemented in C."
|
|
|
|
)
|
|
|
|
|
2020-04-07 12:24:13 +08:00
|
|
|
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
|
|
|
|
|
2020-05-25 10:28:28 +08:00
|
|
|
cmake_policy(SET CMP0054 NEW)
|
|
|
|
cmake_policy(SET CMP0057 NEW)
|
|
|
|
find_package(Doxygen OPTIONAL_COMPONENTS dot dia)
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
set(DOXYGEN_GENERATE_HTML YES)
|
|
|
|
set(DOXYGEN_GENERATE_ YES)
|
|
|
|
set(DOXYGEN_GENERATE_MAN NO)
|
|
|
|
set(DOXYGEN_USE_MATHJAX YES)
|
|
|
|
set(DOCYGEN_GENERATE_TREEVIEW YES)
|
|
|
|
set(DOXYGEN_INLINE_SOURCES YES)
|
|
|
|
set(DOXYGEN_STRIP_CODE_COMMENTS NO)
|
|
|
|
if(Doxygen_dot_FOUND)
|
|
|
|
set(DOXYGEN_HAVE_DOT YES)
|
|
|
|
set(DOXYGEN_DOT_IMAGE_FORMAT "svg")
|
|
|
|
set(DOXYGEN_INTERACTIVE_SVG YES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
doxygen_add_docs(
|
|
|
|
doc
|
|
|
|
${PROJECT_SOURCE_DIR}
|
|
|
|
COMMENT "Generate documentation"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-04-21 00:04:08 +08:00
|
|
|
function(function_timer)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release") # This is local to function
|
|
|
|
add_subdirectory(function_timer EXCLUDE_FROM_ALL)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function_timer()
|
|
|
|
|
2020-04-07 11:50:46 +08:00
|
|
|
include_directories(function_timer/include)
|
2020-04-07 12:00:04 +08:00
|
|
|
# link_libraries(function_timer)
|
2020-04-07 11:50:46 +08:00
|
|
|
# include_directories(${CMAKE_BINARY_DIR}/include)
|
|
|
|
# link_directories(${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
|
|
|
|
|
2020-04-08 21:30:46 +08:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2020-04-08 10:27:27 +08:00
|
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
|
2020-04-24 08:00:57 +08:00
|
|
|
if(MSVC)
|
|
|
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
2020-04-24 08:45:45 +08:00
|
|
|
add_compile_options(/Za)
|
2020-04-24 08:00:57 +08:00
|
|
|
endif(MSVC)
|
|
|
|
|
2020-04-07 11:50:46 +08:00
|
|
|
add_subdirectory(conversions)
|
2020-04-07 12:00:04 +08:00
|
|
|
add_subdirectory(misc)
|
2020-04-07 12:24:13 +08:00
|
|
|
add_subdirectory(project_euler)
|
2020-04-08 06:11:24 +08:00
|
|
|
add_subdirectory(sorting)
|
2020-04-08 09:25:45 +08:00
|
|
|
add_subdirectory(searching)
|
2020-04-08 22:28:58 +08:00
|
|
|
add_subdirectory(numerical_methods)
|
2020-04-07 11:50:46 +08:00
|
|
|
|
2020-04-07 12:24:13 +08:00
|
|
|
if(USE_OPENMP)
|
|
|
|
find_package(OpenMP)
|
2020-04-24 21:04:32 +08:00
|
|
|
if (OpenMP_C_FOUND)
|
|
|
|
message(STATUS "Building with OpenMP Multithreading.")
|
|
|
|
else()
|
|
|
|
message(STATUS "No OpenMP found, no multithreading.")
|
|
|
|
endif()
|
2020-04-07 12:24:13 +08:00
|
|
|
endif()
|
2020-04-07 11:50:46 +08:00
|
|
|
|
|
|
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
|
|
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
|
|
|
include(CPack)
|