Skip to content

Commit

Permalink
move preprocessor macros directly in a standard header file
Browse files Browse the repository at this point in the history
  • Loading branch information
phyBrackets committed Jun 5, 2024
1 parent c0c23c8 commit 6aa3585
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/kdbindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#

option(KDBINDINGS_ENABLE_WARN_UNUSED "Enable warnings for unused ConnectionHandles" OFF)

configure_file(
"${PROJECT_SOURCE_DIR}/cmake/KDBindingsConfig.h.in"
"${CMAKE_BINARY_DIR}/include/KDBindingsConfig.h"
)
option(KDBINDINGS_ENABLE_WARN_UNUSED "Enable warnings for unused ConnectionHandles" ON)

set(HEADERS
binding.h
Expand All @@ -27,6 +22,7 @@ set(HEADERS
connection_evaluator.h
connection_handle.h
utils.h
KDBindingsConfig.h
)

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
Expand All @@ -40,10 +36,14 @@ add_library(KDAB::KDBindings ALIAS KDBindings)
set_target_properties(KDBindings PROPERTIES
INTERFACE_COMPILE_FEATURES cxx_std_17
)

if(KDBINDINGS_ENABLE_WARN_UNUSED)
target_compile_definitions(KDBindings INTERFACE KDBINDINGS_ENABLE_WARN_UNUSED=1)
endif()

target_include_directories(KDBindings INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> # Include the build directory for the configured header
)
if(KDBindings_ERROR_ON_WARNING)
if(MSVC)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#pragma once

// Check if KDBINDINGS_ENABLE_WARN_UNUSED option is set
#cmakedefine KDBINDINGS_ENABLE_WARN_UNUSED

#ifdef KDBINDINGS_ENABLE_WARN_UNUSED
#define KDBINDINGS_WARN_UNUSED [[nodiscard]]
#else
Expand Down
3 changes: 2 additions & 1 deletion src/kdbindings/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#pragma once


#include <assert.h>
#include <memory>
#include <stdexcept>
Expand All @@ -21,7 +22,7 @@
#include <kdbindings/genindex_array.h>
#include <kdbindings/utils.h>

#include <KDBindingsConfig.h>
#include <kdbindings/KDBindingsConfig.h>

/**
* @brief The main namespace of the KDBindings library.
Expand Down

0 comments on commit 6aa3585

Please sign in to comment.