Skip to content

Commit

Permalink
fix(cmake): go back to ALIAS target
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Aug 12, 2024
1 parent 3a3ab40 commit f7951b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ if(NOT TARGET pybind11_headers)
# (long name used here to keep this from clashing in subdirectory mode)
add_library(pybind11_headers INTERFACE)
add_library(pybind11::pybind11_headers ALIAS pybind11_headers) # to match exported target
add_library(pybind11::headers IMPORTED INTERFACE)
set_target_properties(pybind11::headers PROPERTIES INTERFACE_LINK_LIBRARIES pybind11_headers)
add_library(pybind11::headers ALIAS pybind11_headers)

target_include_directories(
pybind11_headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${pybind11_INCLUDE_DIR}>
Expand Down
27 changes: 19 additions & 8 deletions tools/pybind11Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,25 @@ if(CMAKE_SYSTEM_NAME MATCHES Emscripten AND NOT _pybind11_no_exceptions)
if(CMAKE_VERSION VERSION_LESS 3.13)
message(WARNING "CMake 3.13+ is required to build for Emscripten. Some flags will be missing")
else()
set_property(
TARGET pybind11::headers
APPEND
PROPERTY INTERFACE_LINK_OPTIONS -fexceptions)
set_property(
TARGET pybind11::headers
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS -fexceptions)
if(_pybind11_is_config)
set_property(
TARGET pybind11::pybind11_headers
APPEND
PROPERTY INTERFACE_LINK_OPTIONS -fexceptions)
set_property(
TARGET pybind11::pybind11_headers
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS -fexceptions)
else()
set_property(
TARGET pybind11_headers
APPEND
PROPERTY INTERFACE_LINK_OPTIONS -fexceptions)
set_property(
TARGET pybind11_headers
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS -fexceptions)
endif()
endif()
endif()

Expand Down

0 comments on commit f7951b9

Please sign in to comment.