Skip to content

Commit

Permalink
Merge pull request #1 from bytebunny/main
Browse files Browse the repository at this point in the history
- Improve install routines
- Add license
- Make doctest origin transparent, fetch content default but can be turned off
- Prepare to be fit for VCPKG
  • Loading branch information
a4z authored May 8, 2024
2 parents 158c211 + 45ec33d commit 1ed2376
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

cmake_minimum_required(VERSION 3.27)

project(astr VERSION 1.0.0 LANGUAGES CXX)
project(astr VERSION 0.1.1 LANGUAGES CXX)

if(PROJECT_IS_TOP_LEVEL)
# make git ignore the build directory
Expand Down Expand Up @@ -78,29 +78,28 @@ if (ASTR_ADD_INSTALL)

# include gnudirs and add installation of the header file of the astr library
include(GNUInstallDirs)
install(TARGETS astr EXPORT astrTargets)
install(TARGETS astr EXPORT astrTargets INCLUDES DESTINATION "${CMAKE_INSTALL_DATADIR}")
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT astrTargets
FILE astrTargets.cmake
NAMESPACE a4z::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/a4z
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}"
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/astrConfigVersion.cmake
VERSION 1.0.0
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/astrConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/astrConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/a4z
INSTALL_DESTINATION "share/cmake/${PROJECT_NAME}"
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/astrConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/astrConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/a4z
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}"
)

endif()
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Rostyslav Skrypnyk

This comment has been minimized.

Copy link
@a4z

a4z May 8, 2024

Author Owner

oh, just saw I need to fix that :-)


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 13 additions & 7 deletions cmake/testing.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
include_guard(GLOBAL)

include(FetchContent)
option(FETCH_DOCTEST "Use fetch content to get doctest" ON)
if (FETCH_DOCTEST)
message(STATUS "Fetching doctest")

FetchContent_Declare(
doctest
GIT_REPOSITORY "https://github.com/onqtam/doctest"
GIT_TAG "v2.4.11"
)
include(FetchContent)

FetchContent_Declare(
doctest
GIT_REPOSITORY https://github.com/onqtam/doctest
GIT_TAG v2.4.11
OVERRIDE_FIND_PACKAGE
)
endif()

set(DOCTEST_NO_INSTALL True)

FetchContent_MakeAvailable(doctest)
find_package(doctest CONFIG REQUIRED)

add_library(doctest_main STATIC ${PROJECT_SOURCE_DIR}/tests/test_main.cpp)

Expand Down

0 comments on commit 1ed2376

Please sign in to comment.