diff --git a/CMakeLists.txt b/CMakeLists.txt index 89bcbfa378da07d46fc75b45d07ba23200a648ce..48ba8d40d41734be8d1d9cfc54c891dba7ad3fe9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.12) project(AOFlagger) @@ -49,6 +49,15 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") endif() endif() +# Python needs to be found before pybind11 to avoid finding different versions +# of python +find_package( + Python + COMPONENTS Interpreter Development + REQUIRED) +message(STATUS "Using python version ${Python_VERSION}") +include_directories(SYSTEM ${Python_INCLUDE_DIRS}) + list(APPEND ExternalSubmoduleDirectories aocommon pybind11) foreach(ExternalSubmodule IN LISTS ExternalSubmoduleDirectories) if(NOT EXISTS ${CMAKE_SOURCE_DIR}/external/${ExternalSubmodule}) @@ -96,10 +105,6 @@ endif(GSL_INCLUDE_DIR) find_package(Threads REQUIRED) find_package(PNG REQUIRED) -find_package(PythonLibs 3 REQUIRED) -find_package(PythonInterp REQUIRED) -message(STATUS "Using python version ${PYTHON_VERSION_STRING}") -include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS}) # boost::alignment requires Boost 1.56 find_package(Boost 1.56.0 REQUIRED COMPONENTS date_time filesystem system @@ -333,7 +338,7 @@ set(ALL_LIBRARIES ${CASACORE_LIBRARIES} ${FFTW3_LIB} ${CFITSIO_LIBRARY} - ${PYTHON_LIBRARIES} + ${Python_LIBRARIES} ${PNG_LIBRARIES} ${LUA_LIBRARIES} ${Boost_LIBRARIES}