diff Resources/CMake/DcmtkConfiguration.cmake @ 3833:a3e38994d95a

compilation on mips qemu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 Apr 2020 14:45:52 +0200
parents d737173197e1
children 5bba4d249422
line wrap: on
line diff
--- a/Resources/CMake/DcmtkConfiguration.cmake	Wed Apr 15 14:37:40 2020 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Wed Apr 15 14:45:52 2020 +0200
@@ -133,13 +133,34 @@
 
 
 else()
-  # The following line allows to manually add libraries at the
-  # command-line, which is necessary for Ubuntu/Debian packages
-  set(tmp "${DCMTK_LIBRARIES}")
-  include(FindDCMTK)
-  list(APPEND DCMTK_LIBRARIES "${tmp}")
+  if (CMAKE_CROSSCOMPILING AND
+      "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
+
+    CHECK_INCLUDE_FILE_CXX(dcmtk/dcmdata/dcfilefo.h HAVE_DCMTK_H)
+    if (NOT HAVE_DCMTK_H)
+      message(FATAL_ERROR "Please install the libdcmtk-dev package")
+    endif()
+
+    CHECK_LIBRARY_EXISTS(dcmdata "dcmDataDict" "" HAVE_DCMTK_LIB)
+    if (NOT HAVE_DCMTK_LIB)
+      message(FATAL_ERROR "Please install the libdcmtk package")
+    endif()  
 
-  include_directories(${DCMTK_INCLUDE_DIRS})
+    find_path(DCMTK_INCLUDE_DIRS dcmtk/config/osconfig.h
+      /usr/include
+      )
+
+    link_libraries(dcmdata dcmnet dcmjpeg oflog ofstd)
+
+  else()
+    # The following line allows to manually add libraries at the
+    # command-line, which is necessary for Ubuntu/Debian packages
+    set(tmp "${DCMTK_LIBRARIES}")
+    include(FindDCMTK)
+    list(APPEND DCMTK_LIBRARIES "${tmp}")
+
+    include_directories(${DCMTK_INCLUDE_DIRS})
+  endif()
 
   add_definitions(
     -DHAVE_CONFIG_H=1
@@ -210,6 +231,13 @@
       message(FATAL_ERROR "Cannot locate the DICOM dictionary on this system")
     endif()
 
+    if (CMAKE_CROSSCOMPILING AND
+        "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg")
+      # Remove the sysroot prefix
+      file(RELATIVE_PATH tmp ${CMAKE_FIND_ROOT_PATH} ${DCMTK_DICTIONARY_DIR_AUTO})
+      set(DCMTK_DICTIONARY_DIR_AUTO /${tmp} CACHE INTERNAL "")
+    endif()
+
     message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}")
     add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}")
   else()