diff --git a/CMakeLists.txt b/CMakeLists.txt index 18d1243..8defca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,10 @@ find_package(OpenMP REQUIRED) # Setup Python find_package(Python 3.10 # This is a minimum version - COMPONENTS Interpreter Development.Module REQUIRED) + COMPONENTS Interpreter Development REQUIRED) + +# Import nanobind through CMake's find_package mechanism +find_package(nanobind CONFIG REQUIRED) # Our primary target add_library(fast_pauli INTERFACE) diff --git a/fast_pauli/cpp/tests/CMakeLists.txt b/fast_pauli/cpp/tests/CMakeLists.txt index 6667c35..ab9a0c7 100644 --- a/fast_pauli/cpp/tests/CMakeLists.txt +++ b/fast_pauli/cpp/tests/CMakeLists.txt @@ -15,11 +15,16 @@ # Grab all *.cpp files in the directory file(GLOB TEST_SRC CONFIGURE_DEPENDS "*.cpp") +# Build the core parts of nanobind once +nanobind_build_library(nanobind-static) + foreach(TEST_SRC_FILE ${TEST_SRC}) # Strip file extension get_filename_component(TEST_NAME ${TEST_SRC_FILE} NAME_WLE) # Add test executable add_executable(${TEST_NAME} ${TEST_SRC_FILE}) - target_link_libraries(${TEST_NAME} PUBLIC ${PROJECT_NAME} doctest::doctest) + target_link_libraries( + ${TEST_NAME} PUBLIC ${PROJECT_NAME} doctest::doctest nanobind-static + Python::Python Python::Module) add_test(${TEST_NAME} ${TEST_NAME}) endforeach()