diff --git a/CMakeLists.txt b/CMakeLists.txt index 1484a2a0b6b9ee0ae93547e1d9b45cfa1439f856..58e7d201cdf48a87f744a57efa05a7691bc48952 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE) Include(CodeCoverage) endif() -############################################## -# Find system dependencies -find_package(aidge_core REQUIRED) ############################################## # Create target and set properties @@ -42,6 +39,23 @@ file(GLOB_RECURSE inc_files "include/*.hpp") ############################################## #Â creating library add_library(${module_name} ${src_files} ${inc_files}) +# PYTHON BINDING +if (PYBIND) + find_package(Python REQUIRED) + if (${Python_VERSION_MAJOR} LESS 3) + MESSAGE(FATAL_ERROR "Unsupported Python version. Python 3.0.0+ is required") + endif() + generate_python_binding(${project} ${module_name}) + + # Handles Python + pybind11 headers dependencies + target_link_libraries(${module_name} + PUBLIC + pybind11::pybind11 + ) +endif() +############################################## +# Find aidge dependencies +find_package(aidge_core REQUIRED) target_link_libraries(${module_name} PUBLIC _aidge_core # _ is added because we link the target not the project @@ -71,20 +85,6 @@ target_include_directories(${module_name} ${CMAKE_CURRENT_SOURCE_DIR}/src ) -# PYTHON BINDING -if (PYBIND) - find_package(Python REQUIRED) - if (${Python_VERSION_MAJOR} LESS 3) - MESSAGE(FATAL_ERROR "Unsupported Python version. Python 3.0.0+ is required") - endif() - generate_python_binding(${project} ${module_name}) - - # Handles Python + pybind11 headers dependencies - target_link_libraries(${module_name} - PUBLIC - pybind11::pybind11 - ) -endif() target_link_libraries(${module_name} PUBLIC fmt::fmt) target_compile_features(${module_name} PRIVATE cxx_std_14)