-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make ARCH_INDEPENDENT libraries to have CMake configs installed to sh…
…are (#42) * make ARCH_INDEPENDENT libraries to have CMake configs installed to share * add test added test for header only, though it works only in github workflow added some folders to gitignore made github workflow to install not on a system but in a folder `install_dir` formatted some CMakeLists.txt with `cmake-format` * micro fix of test for header_only * Update .gitignore Co-authored-by: Lars Melchior <[email protected]> * maybe fix CI * fix formatting * fix formatting. * maybe fix tests * place comment to the end of command, not as separate command. * check for cmake config in /usr/local/share, not /usr/share --------- Co-authored-by: Lars Melchior <[email protected]>
- Loading branch information
1 parent
2d8a468
commit 5f51898
Showing
7 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/build | ||
/out | ||
/.vs | ||
/.vs | ||
/.cache | ||
/compile_commands.json | ||
/install_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,24 @@ project( | |
|
||
if(TEST_INSTALLED_VERSION) | ||
find_package(dependency 1.2 REQUIRED) | ||
find_package(header_only 1.0 REQUIRED) | ||
find_package(namespaced_dependency 4.5.6 REQUIRED) | ||
find_package(transitive_dependency 7.8.9 REQUIRED) | ||
else() | ||
if(TEST_CPACK) | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Foo Bar <[email protected]>") | ||
endif() | ||
add_subdirectory(dependency) | ||
add_subdirectory(header_only) | ||
add_subdirectory(namespaced_dependency) | ||
add_subdirectory(transitive_dependency) | ||
endif() | ||
|
||
add_executable(main main.cpp) | ||
|
||
target_link_libraries( | ||
main dependency ns::namespaced_dependency transitive_dependency::transitive_dependency | ||
main dependency header_only ns::namespaced_dependency | ||
transitive_dependency::transitive_dependency | ||
) | ||
|
||
enable_testing() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cmake_minimum_required(VERSION 3.14...3.22) | ||
|
||
project( | ||
header_only | ||
VERSION 1.0 | ||
LANGUAGES CXX | ||
DESCRIPTION "A header only dependency for testing PackageProject.cmake" | ||
) | ||
|
||
add_library(${PROJECT_NAME} INTERFACE) | ||
|
||
target_include_directories( | ||
dependency PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}> | ||
) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../.. PackageProject) | ||
|
||
packageProject( | ||
NAME ${PROJECT_NAME} | ||
VERSION ${PROJECT_VERSION} | ||
BINARY_DIR ${PROJECT_BINARY_DIR} | ||
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include | ||
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} | ||
VERSION_HEADER "${PROJECT_NAME}/version.h" | ||
DEPENDENCIES "" | ||
CPACK "${TEST_CPACK}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
inline constexpr long add(int a, int b) { return a + b; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters