DELBERGUE Guillaume
Committed by Anders Lynge Esbensen

Improve FindGREENLIB

Signed-off-by: Guillaume Delbergue <guillaume.delbergue@greensocs.com>
... ... @@ -9,49 +9,70 @@
# KONRAD Frederic <fred.konrad@greensocs.com>
#=============================================================================
MESSAGE(STATUS "Searching for GreenLib")
message(STATUS "Searching for GreenLib")
# The HINTS option should only be used for values computed from the system.
SET(_GREENLIB_HINTS
set(_GREENLIB_HINTS
${GREENLIB_PREFIX}/include
${GREENLIB_PREFIX}/lib
${GREENLIB_PREFIX}/lib-linux
${GREENLIB_PREFIX}/lib-linux64
${GREENLIB_PREFIX}/lib-macos
${GREENLIB_PREFIX}/lib-macosx64
${GREENLIB_PREFIX}/lib-mingw
${GREENLIB_PREFIX}/lib-mingw64
$ENV{GREENLIB_PREFIX}/include
$ENV{GREENLIB_PREFIX}/lib
$ENV{GREENLIB_PREFIX}/lib-linux
$ENV{GREENLIB_PREFIX}/lib-linux64
$ENV{GREENLIB_PREFIX}/lib-macos
$ENV{GREENLIB_PREFIX}/lib-macosx64
$ENV{GREENLIB_PREFIX}/lib-mingw
$ENV{GREENLIB_PREFIX}/lib-mingw64
${CMAKE_INSTALL_PREFIX}/include
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib-linux
${CMAKE_INSTALL_PREFIX}/lib-linux64
${CMAKE_INSTALL_PREFIX}/lib-macos
${CMAKE_INSTALL_PREFIX}/lib-macosx64
${CMAKE_INSTALL_PREFIX}/lib-mingw
${CMAKE_INSTALL_PREFIX}/lib-mingw64
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
SET(_GREENLIB_PATHS
set(_GREENLIB_PATHS
/usr/include
/usr/lib
/usr/lib-linux
/usr/lib-linux64
/usr/lib-macos
/usr/lib-macosx64
/usr/lib-mingw
/usr/lib-mingw64
/usr/local/lib
/usr/local/lib-linux
/usr/local/lib-linux64
/usr/local/lib-macos
/usr/local/lib-macosx64
/usr/local/lib-mingw
/usr/local/lib-mingw64
)
FIND_PATH(GREENLIB_INCLUDE_DIRS
find_path(GREENLIB_INCLUDE_DIRS
NAMES greencontrol/config.h
HINTS ${_GREENLIB_HINTS}
PATHS ${_GREENLIB_PATHS}
)
FIND_LIBRARY(GREENLIB_GREENREG
NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}greenreg${CMAKE_STATIC_LIBRARY_SUFFIX}
find_library(_GREENLIB_GREENREG
NAMES greenreg
HINTS ${_GREENLIB_HINTS}
PATHS ${_GREENLIB_PATHS}
)
find_library(_GREENLIB_GREENSCRIPT
NAMES greenscript
HINTS ${_GREENLIB_HINTS}
PATHS ${_GREENLIB_PATHS}
)
... ... @@ -60,11 +81,12 @@ find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
if("${GREENLIB_INCLUDE_DIRS}" MATCHES "GREENLIB_INCLUDE_DIRS-NOTFOUND")
SET(GREENLIB_FOUND FALSE)
set(GREENLIB_FOUND FALSE)
else("${GREENLIB_INCLUDE_DIRS}" MATCHES "GREENLIB_INCLUDE_DIRS-NOTFOUND")
SET(GREENLIB_FOUND TRUE)
SET(GREENLIB_LIBRARIES ${GREENLIB_GREENREG})
MESSAGE(STATUS "GreenLib include directory = ${GREENLIB_INCLUDE_DIRS}")
MESSAGE(STATUS "GreenLib libraries = ${GREENLIB_LIBRARIES}")
set(GREENLIB_FOUND TRUE)
list(APPEND GREENLIB_LIBRARIES ${_GREENLIB_GREENREG})
list(APPEND GREENLIB_LIBRARIES ${_GREENLIB_GREENSCRIPT})
message(STATUS "GreenLib include directory = ${GREENLIB_INCLUDE_DIRS}")
message(STATUS "GreenLib libraries = ${GREENLIB_LIBRARIES}")
endif("${GREENLIB_INCLUDE_DIRS}" MATCHES "GREENLIB_INCLUDE_DIRS-NOTFOUND")
... ...