Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
15f8d7c1
Unverified
Commit
15f8d7c1
authored
Nov 18, 2021
by
Henry Schreiner
Committed by
GitHub
Nov 18, 2021
Browse files
fix(build): cleaner CMake printouts & IDE folders (#3479)
parent
ff51fcb7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
CMakeLists.txt
CMakeLists.txt
+8
-6
tests/CMakeLists.txt
tests/CMakeLists.txt
+8
-0
No files found.
CMakeLists.txt
View file @
15f8d7c1
...
@@ -16,6 +16,11 @@ else()
...
@@ -16,6 +16,11 @@ else()
cmake_policy
(
VERSION 3.22
)
cmake_policy
(
VERSION 3.22
)
endif
()
endif
()
# Avoid infinite recursion if tests include this as a subdirectory
if
(
DEFINED PYBIND11_MASTER_PROJECT
)
return
()
endif
()
# Extract project version from source
# Extract project version from source
file
(
STRINGS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/pybind11/detail/common.h"
file
(
STRINGS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/pybind11/detail/common.h"
pybind11_version_defines REGEX
"#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) "
)
pybind11_version_defines REGEX
"#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) "
)
...
@@ -45,13 +50,8 @@ if(NOT pybind11_FIND_QUIETLY)
...
@@ -45,13 +50,8 @@ if(NOT pybind11_FIND_QUIETLY)
message
(
STATUS
"pybind11 v
${
pybind11_VERSION
}
${
pybind11_VERSION_TYPE
}
"
)
message
(
STATUS
"pybind11 v
${
pybind11_VERSION
}
${
pybind11_VERSION_TYPE
}
"
)
endif
()
endif
()
# Avoid infinite recursion if tests include this as a subdirectory
if
(
DEFINED PYBIND11_MASTER_PROJECT
)
set
(
PYBIND11_TEST OFF
)
endif
()
# Check if pybind11 is being used directly or via add_subdirectory
# Check if pybind11 is being used directly or via add_subdirectory
if
(
CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR
AND NOT DEFINED PYBIND11_MASTER_PROJECT
)
if
(
CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR
)
### Warn if not an out-of-source builds
### Warn if not an out-of-source builds
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR
)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR
)
set
(
lines
set
(
lines
...
@@ -80,6 +80,8 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR AND NOT DEFINED PYBIND11_MASTER_
...
@@ -80,6 +80,8 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR AND NOT DEFINED PYBIND11_MASTER_
endif
()
endif
()
set
(
pybind11_system
""
)
set
(
pybind11_system
""
)
set_property
(
GLOBAL PROPERTY USE_FOLDERS ON
)
else
()
else
()
set
(
PYBIND11_MASTER_PROJECT OFF
)
set
(
PYBIND11_MASTER_PROJECT OFF
)
set
(
pybind11_system SYSTEM
)
set
(
pybind11_system SYSTEM
)
...
...
tests/CMakeLists.txt
View file @
15f8d7c1
...
@@ -429,6 +429,14 @@ foreach(target ${test_targets})
...
@@ -429,6 +429,14 @@ foreach(target ${test_targets})
endif
()
endif
()
endforeach
()
endforeach
()
# Provide nice organisation in IDEs
if
(
NOT CMAKE_VERSION VERSION_LESS 3.8
)
source_group
(
TREE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../include"
PREFIX
"Header Files"
FILES
${
PYBIND11_HEADERS
}
)
endif
()
# Make sure pytest is found or produce a warning
# Make sure pytest is found or produce a warning
pybind11_find_import
(
pytest VERSION 3.1
)
pybind11_find_import
(
pytest VERSION 3.1
)
...
...
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