Skip to content

Commit

Permalink
Do not overload user-defined PKGCOMPs
Browse files Browse the repository at this point in the history
Allows overload of environment variables like MPISERIAL_C_LIBRARY without it being set to NOTFOUND
  • Loading branch information
bekozi committed Aug 6, 2018
1 parent 4091da5 commit 29196d0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmake/LibFind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,15 @@ function (find_package_component PKG)
if (${PKG}_PATHS)
list (APPEND SEARCH_DIRS ${${PKG}_PATHS})
endif ()

# Start the search for the include file and library file
set (${PKGCOMP}_PREFIX ${PKGCOMP}_PREFIX-NOTFOUND)
set (${PKGCOMP}_INCLUDE_DIR ${PKGCOMP}_INCLUDE_DIR-NOTFOUND)
set (${PKGCOMP}_LIBRARY ${PKGCOMP}_LIBRARY-NOTFOUND)

# Start the search for the include file and library file. Only overload
# if the variable is not defined.
foreach (suffix PREFIX LIBRARY INCLUDE_DIR)
if (NOT DEFINED ${PKGCOMP}_${suffix})
set (${PKGCOMP}_${suffix} ${PKGCOMP}_${suffix}-NOTFOUND)
endif ()
endforeach ()

foreach (dir IN LISTS SEARCH_DIRS)

# Search for include file names in current dirrectory
Expand Down

0 comments on commit 29196d0

Please sign in to comment.