inital commit
parent
d7aed7a836
commit
3f6fceabd6
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
|
# Export compile command -> better tool integration.
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
endif()
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
# Additional infos:
|
||||||
|
# - https://github.com/boostorg/cmake#using-boost-with-fetchcontent
|
||||||
|
#
|
||||||
|
# Find all components:
|
||||||
|
# set(Boost_DEBUG ON) # before adding include(cmake/FetchBoost.cmake) in CMakeLists.txt
|
||||||
|
# (https://stackoverflow.com/questions/29989512/where-can-i-find-the-list-of-boost-component-that-i-can-use-in-cmake)
|
||||||
|
#
|
||||||
|
# Linking:
|
||||||
|
# target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
# Boost::dll
|
||||||
|
# Boost::<lib>
|
||||||
|
# )
|
||||||
|
|
||||||
|
if (NOT DEFINED BOOST_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "BOOST_GIT_TAG is not defined.\n see https://github.com/boostorg/boost and grab a release tag.\n example: set(BOOST_GIT_TAG boost-1.81.0)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (NOT DEFINED BOOST_INCLUDE_LIBRARIES)
|
||||||
|
message(FATAL_ERROR "BOOST_INCLUDE_LIBRARIES is not defined. \n example: set(BOOST_INCLUDE_LIBRARIES thread filesystem system program_options dll pfr).")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Boost options
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
|
||||||
|
set(BOOST_ENABLE_CMAKE ON)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# Fetch boost from github
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
Boost
|
||||||
|
GIT_REPOSITORY https://github.com/boostorg/boost.git
|
||||||
|
GIT_TAG ${BOOST_GIT_TAG}
|
||||||
|
)
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
|
||||||
|
print_git_tag(${BOOST_GIT_TAG})
|
||||||
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
# usage:
|
||||||
|
# FetchContent_MakeAvailable(curl)
|
||||||
|
# target_link_libraries(${PROJECT_NAME} PRIVATE libcurl)
|
||||||
|
|
||||||
|
if (NOT DEFINED CURL_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "CURL_GIT_TAG is not defined.\n see https://github.com/curl/curl and grab a release tag.\n example: set(CURL_GIT_TAG curl-8_0_1)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
curl
|
||||||
|
GIT_REPOSITORY https://github.com/curl/curl.git
|
||||||
|
GIT_TAG ${CURL_GIT_TAG}
|
||||||
|
)
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
|
||||||
|
print_git_tag(${CURL_GIT_TAG})
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
# usage:
|
||||||
|
# FetchContent_MakeAvailable(googletest)
|
||||||
|
# target_link_libraries(${PROJECT_NAME} PRIVATE googletest)
|
||||||
|
#
|
||||||
|
# further reading: https://google.github.io/googletest/quickstart-cmake.html
|
||||||
|
|
||||||
|
if (NOT DEFINED GOOGLE_TEST_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "GOOGLE_TEST_GIT_TAG is not defined.\n see https://github.com/google/googletest and grab a release tag.\n example: set(GOOGLE_TEST_GIT_TAG v1.13.0)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
googletest
|
||||||
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
GIT_TAG ${GOOGLE_TEST_GIT_TAG}
|
||||||
|
)
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
|
||||||
|
print_git_tag(${GOOGLE_TEST_GIT_TAG})
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
# usage:
|
||||||
|
# FetchContent_MakeAvailable(json)
|
||||||
|
# target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
|
if (NOT DEFINED NLOHMANN_JSON_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "NLOHMANN_JSON_GIT_TAG is not defined.\n see https://github.com/nlohmann/json and grab a release tag.\n example: set(NLOHMANN_JSON_GIT_TAG v3.11.2)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
json
|
||||||
|
GIT_REPOSITORY https://github.com/nlohmann/json
|
||||||
|
GIT_TAG ${NLOHMANN_JSON_GIT_TAG}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
|
||||||
|
print_git_tag(${NLOHMANN_JSON_GIT_TAG})
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# Writes the filename to ${CURRENT_FILENAME}
|
||||||
|
macro(print_git_tag GIT_TAG)
|
||||||
|
|
||||||
|
# get current filename
|
||||||
|
set(_CURRENT_FILENAME "")
|
||||||
|
get_filename_component(_CURRENT_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME)
|
||||||
|
|
||||||
|
# print message
|
||||||
|
message(STATUS "${_CURRENT_FILENAME}:> Fetching Version-[${GIT_TAG}]")
|
||||||
|
endmacro()
|
||||||
Loading…
Reference in New Issue