Salome HOME
Copyrights update 2015.
[tools/libbatch.git] / CMakeModules / FindLibbatchPython.cmake
index d460841863c7fc3749da2d603c67bedba559fb10..6c3ecdaea841631b5738bb449ecca6d1059aa8e8 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -37,6 +37,12 @@ ENDIF()
 SET(PYTHON_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to Python directory (interpreter and libs)")
 
 # 2. Find package - config mode first (i.e. looking for XYZ-config.cmake)
+IF(WIN32)
+ IF(CMAKE_BUILD_TYPE STREQUAL Debug)
+  SET(PythonInterp_FIND_VERSION _d)
+  SET(PYTHON_DEFINITIONS "-DHAVE_DEBUG_PYTHON")
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
+ENDIF(WIN32)
 IF(EXISTS "${PYTHON_ROOT_DIR}")
   # Hope to find direclty a CMake config file there
   SET(_CONF_DIR "${PYTHON_ROOT_DIR}/share/cmake") 
@@ -78,8 +84,6 @@ IF (PYTHONINTERP_FOUND)
   # Prepare call to FIND_PACKAGE(PythonLibs) and ensure priority is given to 
   # the location found for the interpreter:
   GET_FILENAME_COMPONENT(_tmp "${_python_dir}" PATH)
-#  SET(PYTHON_LIBRARY ${_tmp}/lib)
-#  SET(PYTHON_INCLUDE_DIR ${_tmp}/include)
   SALOME_FIND_PACKAGE(LibbatchPython PythonLibs MODULE)
   # Restore variables:
   SET(LibbatchPython_FIND_VERSION_EXACT ${_old_EXACT})
@@ -101,7 +105,9 @@ IF (LIBBATCHPYTHON_FOUND)
   # For Python this is the grand-parent of the
   # include directory:
   GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYTHON_INCLUDE_DIR}" PATH)
-  GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+  IF(NOT WIN32)
+    GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+  ENDIF()
 
   # 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR)
   IF(DEFINED ENV{PYTHON_ROOT_DIR})