Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
3dde6ddc
Commit
3dde6ddc
authored
Aug 07, 2017
by
Dean Moldovan
Browse files
Add test for custom CMake export group
parent
017a747d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
CMakeLists.txt
CMakeLists.txt
+4
-3
tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
+16
-0
No files found.
CMakeLists.txt
View file @
3dde6ddc
...
@@ -19,9 +19,6 @@ set(PYBIND11_MASTER_PROJECT OFF)
...
@@ -19,9 +19,6 @@ set(PYBIND11_MASTER_PROJECT OFF)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
set
(
PYBIND11_MASTER_PROJECT ON
)
set
(
PYBIND11_MASTER_PROJECT ON
)
endif
()
endif
()
if
(
NOT PYBIND11_EXPORT_NAME
)
set
(
PYBIND11_EXPORT_NAME
"
${
PROJECT_NAME
}
Targets"
)
endif
()
option
(
PYBIND11_INSTALL
"Install pybind11 header files?"
${
PYBIND11_MASTER_PROJECT
}
)
option
(
PYBIND11_INSTALL
"Install pybind11 header files?"
${
PYBIND11_MASTER_PROJECT
}
)
option
(
PYBIND11_TEST
"Build pybind11 test suite?"
${
PYBIND11_MASTER_PROJECT
}
)
option
(
PYBIND11_TEST
"Build pybind11 test suite?"
${
PYBIND11_MASTER_PROJECT
}
)
...
@@ -133,6 +130,10 @@ if (PYBIND11_INSTALL)
...
@@ -133,6 +130,10 @@ if (PYBIND11_INSTALL)
DESTINATION
${
PYBIND11_CMAKECONFIG_INSTALL_DIR
}
)
DESTINATION
${
PYBIND11_CMAKECONFIG_INSTALL_DIR
}
)
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
if
(
NOT PYBIND11_EXPORT_NAME
)
set
(
PYBIND11_EXPORT_NAME
"
${
PROJECT_NAME
}
Targets"
)
endif
()
install
(
TARGETS pybind11 module embed
install
(
TARGETS pybind11 module embed
EXPORT
"
${
PYBIND11_EXPORT_NAME
}
"
)
EXPORT
"
${
PYBIND11_EXPORT_NAME
}
"
)
if
(
PYBIND11_MASTER_PROJECT
)
if
(
PYBIND11_MASTER_PROJECT
)
...
...
tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
View file @
3dde6ddc
cmake_minimum_required
(
VERSION 3.0
)
cmake_minimum_required
(
VERSION 3.0
)
project
(
test_subdirectory_embed CXX
)
project
(
test_subdirectory_embed CXX
)
set
(
PYBIND11_INSTALL ON CACHE BOOL
""
)
set
(
PYBIND11_EXPORT_NAME test_export
)
add_subdirectory
(
${
PYBIND11_PROJECT_DIR
}
pybind11
)
add_subdirectory
(
${
PYBIND11_PROJECT_DIR
}
pybind11
)
# Test basic target functionality
add_executable
(
test_cmake_build ../embed.cpp
)
add_executable
(
test_cmake_build ../embed.cpp
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::embed
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::embed
)
add_custom_target
(
check $<TARGET_FILE:test_cmake_build>
${
PROJECT_SOURCE_DIR
}
/../test.py
)
add_custom_target
(
check $<TARGET_FILE:test_cmake_build>
${
PROJECT_SOURCE_DIR
}
/../test.py
)
# Test custom export group -- PYBIND11_EXPORT_NAME
add_library
(
test_embed_lib ../embed.cpp
)
target_link_libraries
(
test_embed_lib PRIVATE pybind11::embed
)
install
(
TARGETS test_embed_lib
EXPORT test_export
ARCHIVE DESTINATION bin
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
)
install
(
EXPORT test_export
DESTINATION lib/cmake/test_export/test_export-Targets.cmake
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment