-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply more Beman Standard tweaks for cmake files
- Loading branch information
1 parent
4b87aac
commit 051ab21
Showing
5 changed files
with
131 additions
and
109 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,32 +1,30 @@ | ||
# examples/CMakeLists.txt -*-CMake-*- | ||
# | ||
# cmake-format: off | ||
# examples/CMakeLists.txt -*-makefile-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
include(GNUInstallDirs) | ||
# cmake-format: on | ||
|
||
# List of all buildable examples. | ||
set(EXAMPLES | ||
sample | ||
sample | ||
) | ||
|
||
foreach(EXAMPLE ${EXAMPLES}) | ||
# Add example executable. | ||
add_executable(${EXAMPLE} "") | ||
foreach(example ${EXAMPLES}) | ||
# Add example executable. | ||
add_executable(${example} "") | ||
|
||
# Add example source file. | ||
target_sources( | ||
${EXAMPLE} | ||
PRIVATE | ||
${EXAMPLE}.cpp | ||
) | ||
# Add example source file. | ||
target_sources(${example} PRIVATE ${example}.cpp) | ||
|
||
# Link example with the library. | ||
target_link_libraries(${EXAMPLE} beman.iterator_interface) | ||
# Link example with the library. | ||
target_link_libraries(${example} beman_iterator_interface) | ||
|
||
# Install . | ||
install( | ||
TARGETS ${EXAMPLE} | ||
EXPORT ${TARGETS_EXPORT_NAME} | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
# Install. | ||
install( | ||
TARGETS | ||
${example} | ||
COMPONENT | ||
beman_iterator_interface_examples | ||
DESTINATION | ||
${CMAKE_INSTALL_BINDIR} | ||
) | ||
endforeach() |
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,15 @@ | ||
# include/beman/iterator_interface/CMakeLists.txt -*-cmake-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
target_sources( | ||
beman_iterator_interface | ||
PUBLIC | ||
FILE_SET beman_iterator_interface_headers | ||
TYPE HEADERS | ||
FILES | ||
iterator_interface.hpp | ||
iterator_interface_access.hpp | ||
detail/stl_interfaces/config.hpp | ||
detail/stl_interfaces/fwd.hpp | ||
detail/stl_interfaces/iterator_interface.hpp | ||
) |
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,55 +1,21 @@ | ||
# src/beman/iterator_interface/CMakeLists.txt -*-CMake-*- | ||
# | ||
# src/beman/iterator_interface/CMakeLists.txt -*-cmake-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
add_library(beman.iterator_interface) | ||
add_library(beman::iterator_interface ALIAS beman.iterator_interface) | ||
|
||
target_sources( | ||
beman.iterator_interface | ||
PRIVATE | ||
iterator_interface.cpp | ||
) | ||
|
||
include(GNUInstallDirs) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
target_include_directories(beman.iterator_interface PUBLIC | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}> # <prefix>/include/scratch | ||
) | ||
# Ensure that iterator_interface gets compiled at least once. | ||
target_sources(beman_iterator_interface PUBLIC iterator_interface.cpp) | ||
|
||
# The library is empty -- exclude it | ||
install( | ||
TARGETS beman.iterator_interface | ||
EXPORT ${TARGETS_EXPORT_NAME}1 | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
TARGETS beman_iterator_interface | ||
ARCHIVE | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT beman_iterator_interface_library | ||
EXCLUDE_FROM_ALL | ||
) | ||
|
||
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_LOWER_PROJECT_NAME) | ||
|
||
install( | ||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME} | ||
FILES_MATCHING PATTERN "*.hpp" | ||
TARGETS beman_iterator_interface | ||
FILE_SET beman_iterator_interface_headers | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
COMPONENT beman_iterator_interface_development | ||
) | ||
|
||
target_link_libraries(beman.iterator_interface) | ||
|
||
## Tests | ||
if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) | ||
add_executable(iterator_interface_test "") | ||
|
||
target_sources( | ||
iterator_interface_test | ||
PRIVATE | ||
iterator_interface.t.cpp | ||
) | ||
|
||
target_link_libraries(iterator_interface_test beman.iterator_interface) | ||
target_link_libraries(iterator_interface_test GTest::gtest) | ||
target_link_libraries(iterator_interface_test GTest::gtest_main) | ||
|
||
include(GoogleTest) | ||
gtest_discover_tests(iterator_interface_test) | ||
endif() |
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,34 @@ | ||
# cmake-format: off | ||
# src/beman/iterator_interface/tests/CMakeLists.txt -*-makefile-*- | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# cmake-format: on | ||
|
||
include(GoogleTest) | ||
|
||
# Tests | ||
add_executable(beman_iterator_interface_test) | ||
|
||
target_sources( | ||
beman_iterator_interface_test | ||
PRIVATE | ||
iterator_interface.test.cpp | ||
) | ||
|
||
target_sources( | ||
beman_iterator_interface_test | ||
PRIVATE | ||
FILE_SET beman_iterator_interface_test_headers | ||
TYPE HEADERS | ||
) | ||
|
||
target_link_libraries( | ||
beman_iterator_interface_test | ||
PRIVATE beman_iterator_interface GTest::gtest GTest::gtest_main | ||
) | ||
|
||
# Issue #32: Re-enable ASAN run CI/clang-19. | ||
# | ||
# Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some | ||
# platforms. Temporary switch to gtest_add_tests and skip some Asan checks. | ||
# Change also applied for CI flows. | ||
gtest_add_tests(TARGET beman_iterator_interface_test "" AUTO) |