Salome HOME
Add example explained in french.
[tools/ydefx.git] / CMakeLists.txt
index d9ae075ecf4e5f31d7e646e342730f1154ad8808..e5d03fc039e58bc4f29059a272fceef3e8abe6a4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2019  EDF R&D
+# Copyright (C) 2019-2021 EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -23,14 +23,33 @@ SET (CMAKE_CXX_STANDARD 11)
 ENABLE_TESTING()
 SET(BUILD_SHARED_LIBS TRUE)
 
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ELSE()
+  MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
+
+SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
+IF(EXISTS ${KERNEL_ROOT_DIR})
+  FIND_PACKAGE(SalomeKERNEL REQUIRED)
+  ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
+  INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
+ELSE(EXISTS ${KERNEL_ROOT_DIR})
+  MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
+ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+
+# Platform setup
+# ==============
+INCLUDE(SalomeSetupPlatform)   # From CONFIGURATION
+# Always build libraries as shared objects:
+SET(BUILD_SHARED_LIBS TRUE)
+
 OPTION(YDEFX_BUILD_GUI "Generate widgets" ON)
 
 FIND_PACKAGE(Py2cpp REQUIRED)
 
-# SalomeKERNEL can be useful in order to define SALOME_INSTALL directories and
-# for using salome test, but it is not a c++ dependency.
-FIND_PACKAGE(SalomeKERNEL NO_MODULE)
-
 IF(NOT SalomeKERNEL_FOUND)
   MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used")
 ELSE()