Skip to content

Commit

Permalink
Avoid to export Debug flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Jan 20, 2025
1 parent a7ee8c8 commit e84de4c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

if(CMAKE_BUILD_TYPE STREQUAL xDebug)
if(CMAKE_SKIP_INSTALL_RULES)
include(FetchContent)

# Add project_options from https://github.com/aminya/project_options
Expand Down Expand Up @@ -80,6 +80,10 @@ if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(examples)
endif()

if(CMAKE_SKIP_INSTALL_RULES)
return()
endif()

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ doc:

build:
CC=$(CXX) cmake --fresh -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_CXX_COMPILER=$(CXX) # XXX -DCMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)"
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 \
-D CMAKE_SKIP_INSTALL_RULES=1 \
-D CMAKE_CXX_COMPILER=$(CXX) # XXX -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)"
cmake --build $(BUILD)

# NOTE: without install! CK
Expand Down
3 changes: 1 addition & 2 deletions cmake/CMakeLinuxPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"name": "release-base-Linux",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-shadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Woverloaded-virtual -Wformat=2 -Wno-error"
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
},
"condition": {
"type": "notEquals",
Expand Down
6 changes: 5 additions & 1 deletion src/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
add_library(${TARGET_NAME} STATIC)
add_library(${TARGET_ALIAS} ALIAS ${TARGET_NAME})

if(CMAKE_BUILD_TYPE STREQUAL xDebug)
if(CMAKE_SKIP_INSTALL_RULES)
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_options>)
target_link_libraries(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${TARGET_NAME}_project_warnings>)
endif()
Expand Down Expand Up @@ -198,6 +198,10 @@ target_compile_features(${TARGET_NAME} PUBLIC
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_26>>:cxx_std_23>"
)

if(CMAKE_SKIP_INSTALL_RULES)
return()
endif()

install(
TARGETS ${TARGET_NAME}
EXPORT ${TARGETS_EXPORT_NAME}1
Expand Down
2 changes: 1 addition & 1 deletion tests/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ foreach(test ${execution_tests})
add_test(NAME ${TEST_EXE} COMMAND $<TARGET_FILE:${TEST_EXE}>)
endforeach()

if(ROJECT_IS_TOP_LEVEL)
if(NOT ROJECT_IS_TOP_LEVEL)
# test if the targets are findable from the build directory
# cmake-format: off
add_test(NAME find-package-test
Expand Down

0 comments on commit e84de4c

Please sign in to comment.