aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_cmake_build/subdirectory_function
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
commite76cdab6dd77bad411e6ac9372ee527aff89ef17 (patch)
treee9868f05cf455336d75f33b1312d71034f8fb334 /3rdparty/pybind11/tests/test_cmake_build/subdirectory_function
parentc6cdf30501dcb2da01361229dd66a05dad73a132 (diff)
downloadnextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.gz
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.bz2
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.zip
Update pybind11 to version 2.6.1
Diffstat (limited to '3rdparty/pybind11/tests/test_cmake_build/subdirectory_function')
-rw-r--r--3rdparty/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt38
1 files changed, 32 insertions, 6 deletions
diff --git a/3rdparty/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt b/3rdparty/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt
index 278007ae..624c600f 100644
--- a/3rdparty/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt
+++ b/3rdparty/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt
@@ -1,8 +1,34 @@
-cmake_minimum_required(VERSION 2.8.12)
-project(test_subdirectory_module CXX)
+cmake_minimum_required(VERSION 3.4)
-add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
-pybind11_add_module(test_cmake_build THIN_LTO ../main.cpp)
+# The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with
+# some versions of VS that have a patched CMake 3.11. This forces us to emulate
+# the behavior using the following workaround:
+if(${CMAKE_VERSION} VERSION_LESS 3.18)
+ cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
+else()
+ cmake_policy(VERSION 3.18)
+endif()
-add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
- ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
+project(test_subdirectory_function CXX)
+
+add_subdirectory("${PYBIND11_PROJECT_DIR}" pybind11)
+pybind11_add_module(test_subdirectory_function ../main.cpp)
+set_target_properties(test_subdirectory_function PROPERTIES OUTPUT_NAME test_cmake_build)
+
+if(DEFINED Python_EXECUTABLE)
+ set(_Python_EXECUTABLE "${Python_EXECUTABLE}")
+elseif(DEFINED PYTHON_EXECUTABLE)
+ set(_Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
+else()
+ message(FATAL_ERROR "No Python executable defined (should not be possible at this stage)")
+endif()
+
+add_custom_target(
+ check_subdirectory_function
+ ${CMAKE_COMMAND}
+ -E
+ env
+ PYTHONPATH=$<TARGET_FILE_DIR:test_subdirectory_function>
+ ${_Python_EXECUTABLE}
+ ${PROJECT_SOURCE_DIR}/../test.py
+ ${PROJECT_NAME})