Unverified Commit d13b33e7 authored by Stuart Sides's avatar Stuart Sides Committed by GitHub
Browse files

Modified ALLLIBDIRS to just have paths with no file names. Used for l… (#4031)

* Modified ALLLIBDIRS to just have paths with no file names. Used for loader -L option. Closes #3886

* Update CHANGELOG.md

* Fixed reference of kakadu library for MacOS

* Combined regexs and loops. Added special handling of .so's for MacOS
parent 6db3eb8f
Loading
Loading
Loading
Loading
+29 −14
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ include(InstallThirdParty)
include(cmake/gtest.cmake)
include(GoogleTest)

include(CMakePrintHelpers)

#===============================================================================
#===============================================================================
# Project information
@@ -316,19 +318,32 @@ foreach (_variableName ${_variableNames})
    list(APPEND ALLINCDIRS "${${_variableName}}")
  elseif (_variableName MATCHES ".+_INCLUDE_PATH$")
    list(APPEND ALLINCDIRS "${${_variableName}}")
   endif(_variableName MATCHES ".+_INCLUDE_DIR$")
  endif()
endforeach()

# get all Library variables
foreach (_variableName ${_variableNames})
  get_filename_component(LIBDIR "${${_variableName}}" DIRECTORY)
  get_filename_component(LIBNAME "${${_variableName}}" NAME)

  if (_variableName MATCHES "^CMAKE+")
   elseif (_variableName MATCHES ".+_LIBRARY$")
     list(APPEND ALLLIBDIRS "${LIBDIR}")
     list(APPEND ALLLIBS "${${_variableName}}")
   elseif (_variableName MATCHES ".+_LIBRARIES$")
     list(APPEND ALLLIBDIRS "${LIBDIR}")
     list(APPEND ALLLIBS "${${_variableName}}")
  elseif (_variableName MATCHES ".+_LIBRARY$|.+_LIBRARIES")
    foreach(ITEM IN LISTS ${_variableName})
      get_filename_component(LIBDIR ${ITEM} DIRECTORY)
      get_filename_component(LIBNAME ${ITEM} NAME)
      # Some library dependencies identified by the find_package commands are not
      # libraries (i.e., *.so,*.dylib,*.a) or name spaces (e.g., Qt5::Xml). 
      # Remove the ones that are not libraries or name spaces  (e.g., OPENGL.framework).
      if(LIBNAME MATCHES ".+\.so$|.+\.dylib$|.+\.a$|.+::.+$|.+\.SO$|.+\.DYLIB$|.+\.A$")
        # For MacOS, .so's are not the same as .dylib's, need to add the full path to the .so
        if((APPLE) AND (LIBNAME MATCHES ".+\.so$|.+\.SO"))
          list(APPEND ALLLIBS "${ITEM}")
        else()
          list(APPEND ALLLIBDIRS ${LIBDIR})
          list(APPEND ALLLIBS ${LIBNAME})
        endif()
      endif()
    endforeach()
  endif()
endforeach()