get_filename_component(CMAKE_INCLUDE_PATH "${PYTHON_BIN_DIR}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE)
get_filename_component(CMAKE_LIBRARY_PATH "${PYTHON_BIN_DIR}/../lib" ABSOLUTE)
ENDIF (PYTHONINTERP_FOUND)
- FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
+ # Set PythonLibs_FIND_VERSION To avoid problems when several versions are in the system
+ SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING})
+ set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR} CACHE PATH "Path to Python directory")
+ if(EXISTS ${PYTHON_ROOT_DIR})
+ if(WINDOWS)
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(PYTHON_LIB_SUFFIX _d)
+ else(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(PYTHON_LIB_SUFFIX)
+ endif(CMAKE_BUILD_TYPE STREQUAL Debug)
+ set(PYTHON_INCLUDE_DIR ${PYTHON_ROOT_DIR}/include)
+ set(PYTHON_LIBRARY ${PYTHON_ROOT_DIR}/libs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}${PYTHON_LIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+ endif(WINDOWS)
+ endif(EXISTS ${PYTHON_ROOT_DIR})
+ FIND_PACKAGE(PythonLibs)
FIND_PACKAGE(SWIG)
ENDIF (BUILD_PYTHON_WRAPPING)
DESTINATION share/libbatch/misc)
GET_TARGET_PROPERTY(LIBBATCH_ABS_PATH batch LOCATION)
-GET_FILENAME_COMPONENT(LIBBATCH_REAL_NAME ${LIBBATCH_ABS_PATH} NAME)
+GET_FILENAME_COMPONENT(LIBBATCH_REAL_NAME ${LIBBATCH_ABS_PATH} NAME_WE)
+#To avoid wrong extension on Windows
+SET(LIBBATCH_REAL_NAME ${LIBBATCH_REAL_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libbatchConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libbatchConfig.cmake @ONLY)