]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
CMake: FindDIM to set abolute path to DIM library
authoragrigora <alina.grigoras@cern.ch>
Thu, 5 Feb 2015 12:48:20 +0000 (13:48 +0100)
committeragrigora <alina.grigoras@cern.ch>
Wed, 25 Feb 2015 12:10:30 +0000 (13:10 +0100)
 - Adding FindDIM to set absolute path to DIM library
 - link_libraries is becoming obsolete and it is not propagated by the target to the dependencies

CMakeLists.txt
cmake/FindDIM.cmake [new file with mode: 0644]

index 928a9d3269234523ca8764a2200472a19c36d6ac..0ece85984422a21a82dd4407b7bf29ce6fe105e5 100644 (file)
@@ -113,12 +113,15 @@ else()
   set(DATE_CONFIG CACHE STRING "date-config script location")
   set(DIMDIT CACHE STRING "dim installation folder")
   set(ODIR CACHE STRING "dim plaform, usually \"linux\"")
-  if(DATE_CONFIG)
-    if(DIMDIR AND ODIR)
-      find_package(DATE)
-    else()
-      message(FATAL_ERROR "DATE enabled but no DIMDIR and ODIR set. Please set DIMDIR and ODIR")
-    endif()
+
+  if(DIMDIR AND ODIR)
+    find_package(DIM)
+  endif()
+
+  if(DIM_FOUND)
+    find_package(DATE)
+  else()
+    message(FATAL_ERROR "DATE enabled but no DIMDIR and ODIR set. Please set DIMDIR and ODIR")
   endif()
 
   # daqDA
@@ -149,33 +152,33 @@ else()
     endif(NOT DA)
   endif(DARPM)
 
-  # DA is enabled
-  # Setting variables in cache to be accesible by ccmake
-  set(ALIROOT_STATIC CACHE STRING "ENABLE static building of AliRoot: ON")
-  if(DA)
-    if(NOT DIMDIR AND NOT ODIR)
-      set(DA FALSE)
-      message(FATAL_ERROR "DAs enabled but no DIMDIR and ODIR set. Please set DIMDIR to DIM installation and ODIR to platform (default linux)")
-    endif()
-
-    if(NOT DATE_FOUND)
-      set(DA FALSE)
-      message(FATAL_ERROR "DAs enabled but no DATE support found. Please point to your date installation using \"DATE_CONFIG\" variable")
-    endif()
-
-    if(NOT daqDA_FOUND)
-      set(DA FALSE)
-      message(FATAL_ERROR "DAs enabled but no daqDA support found. Please point to your daqDA installation using \"daqDA\" variable")
-    endif()
-
-    if(NOT AMORE_FOUND)
-      set(DA FALSE)
-      message(FATAL_ERROR "DAs enabled but no AMORE support found. Please point to your AMORE installation using \"AMORE_CONFIG\" variable")
-    endif()
+    # DA is enabled
+    # Setting variables in cache to be accesible by ccmake
+    set(ALIROOT_STATIC CACHE STRING "ENABLE static building of AliRoot: ON")
+    if(DA)
+        if(NOT DIM_FOUND)
+            set(DA FALSE)
+            message(FATAL_ERROR "DAs enabled but no DIMDIR and ODIR set. Please set DIMDIR to DIM installation and ODIR to platform (default linux)")
+        endif()
+
+        if(NOT DATE_FOUND)
+            set(DA FALSE)
+            message(FATAL_ERROR "DAs enabled but no DATE support found. Please point to your date installation using \"DATE_CONFIG\" variable")
+        endif()
+
+        if(NOT daqDA_FOUND)
+            set(DA FALSE)
+            message(FATAL_ERROR "DAs enabled but no daqDA support found. Please point to your daqDA installation using \"daqDA\" variable")
+        endif()
+
+        if(NOT AMORE_FOUND)
+            set(DA FALSE)
+            message(FATAL_ERROR "DAs enabled but no AMORE support found. Please point to your AMORE installation using \"AMORE_CONFIG\" variable")
+        endif()
       
-    # Enable static libraries
-    set(ALIROOT_STATIC TRUE)
-    message(STATUS "DAs enabled")
+        # Enable static libraries
+        set(ALIROOT_STATIC TRUE)
+        message(STATUS "DAs enabled")
   endif(DA)
 
   # MDC rpm creation enables the static build
@@ -319,9 +322,9 @@ else()
     if(ROOT_HASALIEN STREQUAL "no")
       message(FATAL_ERROR "Shuttle needs ROOT build with AliEn support. Please build ROOT with AliEn support. Do not forget to set ALIEN to your AliEn installation")
     endif()
-      
-    if(DIMDIR AND ODIR AND ALIEN)
-      add_subdirectory(SHUTTLE)
+
+    if(DIM_FOUND AND ALIEN)
+        add_subdirectory(SHUTTLE)
     else()
       message(FATAL_ERROR "SHUTTLE enabled! Please specify DIMDIR, ODIR and ALIEN")
     endif()
diff --git a/cmake/FindDIM.cmake b/cmake/FindDIM.cmake
new file mode 100644 (file)
index 0000000..0b3b7f7
--- /dev/null
@@ -0,0 +1,29 @@
+# Find module for DIM module
+# Setting:
+#       - DIM_LIBRARIES 
+#       - DIM_INCLUDE_DIR
+
+set(DIM_FOUND FASLE)
+
+if(DIMDIR AND ODIR)
+    # check for the existance of the DIM library
+    find_library(DIM_LIBRARIES NAMES dim PATHS ${DIMDIR}/${ODIR}  NO_DEFAULT_PATH DOC "Path to DIM library")
+    
+    if(NOT DIM_LIBRARIES)
+        message(FATAL "DIM library not found inside ${DIMDIR}/${ODIR}")
+    else()
+        message(STATUS "Found DIM library: ${DIM_LIBRARIES}")
+    endif()
+
+    # check for the existance of the DIM header
+    find_path(DIM_INCLUDE_DIR NAMES dim.h PATHS ${DIMDIR}/dim NO_DEFAULT_PATH  DOC "Path to DIM header folders.")
+    
+    if(NOT DIM_INCLUDE_DIR)
+        message(FATAL "DIM header not found inside ${DIM}/dim folder")
+    else()
+        message(STATUS "Found DIM header folder: ${DIM_INCLUDE_DIR}")
+    endif()
+    
+    set(DIM_FOUND true)
+    mark_as_advanced(DIM_LIBRARIES DIM_INCLUDE_DIR)
+endif()
\ No newline at end of file