CMakeLists.txt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. cmake_minimum_required(VERSION 3.5)
  2. project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE)
  3. set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
  4. find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter)
  5. if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND)
  6. message (FATAL_ERROR "Failed to find Python${Python_REQUESTED_VERSION}")
  7. endif()
  8. if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
  9. AND NOT Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
  10. message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
  11. endif()
  12. if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
  13. AND Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
  14. message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
  15. endif()
  16. set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION})
  17. find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter)
  18. if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND)
  19. message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}")
  20. endif()
  21. if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
  22. AND NOT Python_INTERPRETER_ID STREQUAL "IronPython")
  23. message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
  24. endif()
  25. if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
  26. AND Python_INTERPRETER_ID STREQUAL "IronPython")
  27. message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
  28. endif()