You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyPython2.cmake 1.4KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. # ---------------------------------
  2. # Finds Python
  3. # Adds library to target
  4. # Adds include path
  5. # ---------------------------------
  6. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyPython2)
  7. SET(Python_ADDITIONAL_VERSIONS 2.7)
  8. # Stops lookup as soon as a version satisfying the version constraints is found.
  9. # Important when building both 32bits andd 64bits versions on the same machine.
  10. # CMake might go for the 64bits version of Python when building 32bits, making the compilation fail.
  11. # To work, you need to ensure that 32bits versions of Python appearing first in the Path.
  12. # This is only needed for windows.
  13. SET(Python2_FIND_STRATEGY LOCATION)
  14. FIND_PACKAGE(Python2 COMPONENTS Development)
  15. IF(Python2_FOUND)
  16. OV_PRINT(OV_PRINTED " Found Python 2 at ${Python2_LIBRARIES}")
  17. INCLUDE_DIRECTORIES(${Python2_INCLUDE_DIRS})
  18. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Python2_LIBRARIES})
  19. IF(WIN32)
  20. # These are needed not to cause a popup on machines missing the dll
  21. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized Delayimp )
  22. SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DELAYLOAD:python27.dll")
  23. ENDIF()
  24. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyPython2)
  25. ELSE()
  26. OV_PRINT(OV_PRINTED " FAILED to find Python 2 (needs v2.7 with bitness matching build target ${PLATFORM_TARGET})")
  27. ENDIF()
  28. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyPython2 "Yes")