From 9741e449c16aa7ab514a259f71c964e2e9800c4e Mon Sep 17 00:00:00 2001 From: Nathan Gibson Date: Thu, 29 Oct 2020 08:41:10 -0600 Subject: [PATCH 1/2] Updated to newer version of FetchContent build system. --- CMakeLists.txt | 28 +++++++++++++++++-- ...ncies.cmake => develop_dependencies.cmake} | 10 +------ cmake/unit_testing.cmake | 15 +++++----- 3 files changed, 35 insertions(+), 18 deletions(-) rename cmake/{elementary_dependencies.cmake => develop_dependencies.cmake} (72%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06d2fdc..3246244 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,20 +16,44 @@ set( CMAKE_CXX_STANDARD_REQUIRED YES ) option( elementary_unit_tests "Compile the elementary unit tests and integrate with ctest" ON ) +option( strict_compile + "Treat all warnings as errors." ON + ) + +# Compile flags +set( common_flags "-Wall" "-Wextra" "-Wpedantic" ) +set( strict_flags "-Werror" ) +set( release_flags "-O3" ) +set( debug_flags "-O0" "-g" ) ######################################################################## # Dependencies ######################################################################## -include( cmake/elementary_dependencies.cmake ) +set( REPOSITORIES "release" + CACHE STRING + "Options for where to fetch repositories: develop, release, local" + ) + +if( REPOSITORIES STREQUAL "develop" ) + include( cmake/develop_dependencies.cmake ) + +elseif( REPOSITORIES STREQUAL "release" ) + include( cmake/release_dependencies.cmake ) + +elseif( REPOSITORIES STREQUAL "local" ) + include( cmake/local_dependencies.cmake ) + +endif() ######################################################################## # Project targets ######################################################################## -add_library( elementary INTERFACE ) +add_library( elementary INTERFACE + ) target_include_directories( elementary INTERFACE src/ ) target_link_libraries( elementary INTERFACE catch-adapter diff --git a/cmake/elementary_dependencies.cmake b/cmake/develop_dependencies.cmake similarity index 72% rename from cmake/elementary_dependencies.cmake rename to cmake/develop_dependencies.cmake index a393ba3..e2060b7 100644 --- a/cmake/elementary_dependencies.cmake +++ b/cmake/develop_dependencies.cmake @@ -1,21 +1,13 @@ cmake_minimum_required( VERSION 3.14 ) - include( FetchContent ) - -####################################################################### -# Forward declarations -####################################################################### - - - ####################################################################### # Declare project dependencies ####################################################################### FetchContent_Declare( catch-adapter GIT_REPOSITORY https://github.com/njoy/catch-adapter - GIT_TAG origin/build/fetchcontent + GIT_TAG origin/master GIT_SHALLOW TRUE ) diff --git a/cmake/unit_testing.cmake b/cmake/unit_testing.cmake index 4de4054..26bf7f1 100644 --- a/cmake/unit_testing.cmake +++ b/cmake/unit_testing.cmake @@ -2,23 +2,24 @@ # Setup ####################################################################### -message( STATUS "Adding unit testing" ) +message( STATUS "Adding elementary unit testing" ) enable_testing() ####################################################################### # Unit testing directories ####################################################################### -add_subdirectory( src/elementary/Level/test ) -add_subdirectory( src/elementary/Identifier/test ) -add_subdirectory( src/elementary/FundamentalParticleID/test ) + add_subdirectory( src/elementary/ElementID/test ) +add_subdirectory( src/elementary/FundamentalParticleID/test ) +add_subdirectory( src/elementary/Identifier/test ) add_subdirectory( src/elementary/IsotopeID/test ) -add_subdirectory( src/elementary/NuclideID/test ) +add_subdirectory( src/elementary/Level/test ) add_subdirectory( src/elementary/NucleusID/test ) +add_subdirectory( src/elementary/NuclideID/test ) add_subdirectory( src/elementary/ParticleID/test ) -add_subdirectory( src/elementary/ParticleTupleID/test ) add_subdirectory( src/elementary/ParticlePairID/test ) -add_subdirectory( src/elementary/ReactionType/test ) +add_subdirectory( src/elementary/ParticleTupleID/test ) add_subdirectory( src/elementary/ReactionID/test ) +add_subdirectory( src/elementary/ReactionType/test ) add_subdirectory( src/elementary/test ) From 521a6d0f8520c901f3dae86d0db788bfff88be87 Mon Sep 17 00:00:00 2001 From: Nathan Gibson Date: Thu, 29 Oct 2020 09:50:19 -0600 Subject: [PATCH 2/2] Added release depenendencies. --- cmake/release_dependencies.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmake/release_dependencies.cmake diff --git a/cmake/release_dependencies.cmake b/cmake/release_dependencies.cmake new file mode 100644 index 0000000..2b1d366 --- /dev/null +++ b/cmake/release_dependencies.cmake @@ -0,0 +1,19 @@ +cmake_minimum_required( VERSION 3.14 ) +include( FetchContent ) + +####################################################################### +# Declare project dependencies +####################################################################### + +FetchContent_Declare( catch-adapter + GIT_REPOSITORY https://github.com/njoy/catch-adapter + GIT_TAG fb84b82ebf7a4789aa43cea560680cf745c6ee4f + ) + +####################################################################### +# Load dependencies +####################################################################### + +FetchContent_MakeAvailable( + catch-adapter + )