]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #830 - cmake must fail if SolveSpace has not been found
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 11 Sep 2015 11:43:04 +0000 (14:43 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 11 Sep 2015 11:43:28 +0000 (14:43 +0300)
CMakeCommon/FindSolveSpace.cmake
CMakeLists.txt
make.sh
src/SketchSolver/CMakeLists.txt

index 40acbbe8ce25d0645fc83f3d40551c735d17fe11..2830c7bba7bdb7dc26cf3b9e32f440923823e938 100644 (file)
@@ -1,8 +1,35 @@
+# - Try to  find SolveSpace
+# Once done this will define
+#
+#  SolveSpace_FOUND - system has SolveSpace
+#  SolveSpace_INCLUDE_DIRS - the SolveSpace include directory
+#  SolveSpace_LIBRARIES - Link these to use SolveSpace
+
+#=============================================================================
 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+#=============================================================================
+
+SET(_SolveSpace_PATHS $ENV{SOLVESPACE_ROOT_DIR})
+
+FIND_PATH(SolveSpace_INCLUDE_DIR NAMES slvs.h
+          PATHS ${_SolveSpace_PATHS}
+          PATH_SUFFIXES include)
+
+FIND_LIBRARY(SolveSpace_LIBRARY NAMES slvs
+             PATHS ${_SolveSpace_PATHS}
+             PATH_SUFFIXES lib)
+
+SET(SolveSpace_INCLUDE_DIRS ${SolveSpace_INCLUDE_DIR})
+SET(SolveSpace_LIBRARIES ${SolveSpace_LIBRARY})
 
-SET(SLVS_ROOT_DIR $ENV{SOLVESPACE_ROOT_DIR})
+INCLUDE(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set SolveSpace_FOUND to TRUE
+# if all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SolveSpace DEFAULT_MSG
+                                  SolveSpace_LIBRARY SolveSpace_INCLUDE_DIR)
 
-INCLUDE_DIRECTORIES(${SLVS_ROOT_DIR}/include)
-LINK_DIRECTORIES(${SLVS_ROOT_DIR}/lib)
+MARK_AS_ADVANCED(SolveSpace_LIBRARY SolveSpace_INCLUDE_DIR)
 
-SET(SLVS_LIBRARIES slvs)
+IF(NOT SolveSpace_FIND_QUIET)
+    MESSAGE(STATUS "SolveSpace found at ${_SolveSpace_PATHS}")
+ENDIF()
\ No newline at end of file
index 1ac46e6910996d9e273bd9138784b261a7a4a4aa..2702757541e05d58c076157b3ca823d3a3f5fe48 100644 (file)
@@ -10,11 +10,9 @@ INCLUDE(Common)
 INCLUDE(FindQt)
 INCLUDE(FindPython)
 INCLUDE(FindSalome)
-INCLUDE(FindSolveSpace)
 INCLUDE(FindCAS)
 INCLUDE(FindSUIT)
 
-
 IF(UNIX)
   IF(CMAKE_COMPILER_IS_GNUCC)
     #C++11 is not supported on some platforms, disable it 
diff --git a/make.sh b/make.sh
index 2b19c4102e6dafa90442d4514a2dd9a49438cac2..5c82271858e4e82679e6b76a2ec128bb9c1a6e7c 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -20,5 +20,7 @@ CMAKE_ARGS="${CMAKE_ARGS} ${SOURCES_DIR}"
 mkdir -p ${BUILD_DIR}
 cd ${BUILD_DIR}
 
+set -e
+
 cmake -G "Unix Makefiles" ${CMAKE_ARGS}
 make -j$(nproc) install
index 7c4c8c29e0cc3fdb0743b641024ed7e2159a91b2..a625eeaf1df590bc9ae3f03e29e1137c5916838e 100644 (file)
@@ -1,7 +1,7 @@
 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 INCLUDE(Common)
-INCLUDE(FindSolveSpace)
+FIND_PACKAGE(SolveSpace REQUIRED)
 
 SET(PROJECT_HEADERS
     SketchSolver.h
@@ -52,7 +52,7 @@ SET(PROJECT_SOURCES
 )
 
 SET(PROJECT_LIBRARIES
-    ${SLVS_LIBRARIES}
+    ${SolveSpace_LIBRARIES}
     Config
     Events
     ModelAPI
@@ -60,6 +60,7 @@ SET(PROJECT_LIBRARIES
 )
 
 INCLUDE_DIRECTORIES(
+    ${SolveSpace_INCLUDE_DIRS}
     ${PROJECT_SOURCE_DIR}/src/Config
     ${PROJECT_SOURCE_DIR}/src/SketchPlugin
     ${PROJECT_SOURCE_DIR}/src/ModelAPI