Merge pull request #72 from nils-a/ebuild-prep

switched to find_optional_package to require or ignore opional packages
This commit is contained in:
Otavio Salvador 2011-08-31 07:42:28 -07:00
commit d5f029d26b
6 changed files with 35 additions and 18 deletions

View File

@ -79,13 +79,13 @@ check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(unistd.h HAVE_UNISTD_H)
# Libraries that we have a hard dependency on # Libraries that we have a hard dependency on
find_package(OpenSSL REQUIRED) find_required_package(OpenSSL)
if(NOT WIN32) if(NOT WIN32)
find_package(ZLIB REQUIRED) find_required_package(ZLIB)
find_optional_package(ALSA) find_suggested_package(ALSA)
find_optional_package(PulseAudio) find_optional_package(PulseAudio)
find_optional_package(Cups) find_suggested_package(Cups)
endif() endif()
# Endian # Endian
@ -111,7 +111,7 @@ if(APPLE)
endif() endif()
# Build CUnit # Build CUnit
find_package(CUnit) find_optional_package(CUnit)
if(CUNIT_FOUND) if(CUNIT_FOUND)
add_subdirectory(cunit) add_subdirectory(cunit)
enable_testing() enable_testing()

View File

@ -25,13 +25,13 @@ if(NOT WIN32)
add_subdirectory(test) add_subdirectory(test)
# Build X11 Client # Build X11 Client
find_package(X11) find_suggested_package(X11)
if(X11_FOUND) if(X11_FOUND)
add_subdirectory(X11) add_subdirectory(X11)
endif() endif()
# Build DirectFB Client # Build DirectFB Client
find_package(DirectFB) find_optional_package(DirectFB)
if(DIRECTFB_FOUND) if(DIRECTFB_FOUND)
add_subdirectory(DirectFB) add_subdirectory(DirectFB)
endif() endif()

View File

@ -51,21 +51,21 @@ if(WITH_MANPAGES)
endif(XMLTO_FOUND) endif(XMLTO_FOUND)
endif(WITH_MANPAGES) endif(WITH_MANPAGES)
find_package(Xinerama) find_suggested_package(Xinerama)
if(XINERAMA_FOUND) if(XINERAMA_FOUND)
add_definitions(-DWITH_XINERAMA -DWITH_XEXT) add_definitions(-DWITH_XINERAMA -DWITH_XEXT)
include_directories(${XINERAMA_INCLUDE_DIRS}) include_directories(${XINERAMA_INCLUDE_DIRS})
target_link_libraries(xfreerdp ${XINERAMA_LIBRARIES}) target_link_libraries(xfreerdp ${XINERAMA_LIBRARIES})
endif() endif()
find_package(Xext) find_suggested_package(Xext)
if(XEXT_FOUND) if(XEXT_FOUND)
add_definitions(-DWITH_XEXT) add_definitions(-DWITH_XEXT)
include_directories(${XEXT_INCLUDE_DIRS}) include_directories(${XEXT_INCLUDE_DIRS})
target_link_libraries(xfreerdp ${XEXT_LIBRARIES}) target_link_libraries(xfreerdp ${XEXT_LIBRARIES})
endif() endif()
find_package(Xcursor) find_suggested_package(Xcursor)
if(Xcursor_FOUND) if(Xcursor_FOUND)
add_definitions(-DWITH_XCURSOR) add_definitions(-DWITH_XCURSOR)
include_directories(${Xcursor_INCLUDE_DIRS}) include_directories(${Xcursor_INCLUDE_DIRS})

View File

@ -1,7 +1,10 @@
# - FindOptionalPackage # - FindOptionalPackage
# Enable or disable optional packages. Also force optional packages. # Enable or disable optional packages. Also force optional packages.
# #
# This module defines the following variables: # This module defines the following macros:
# find_required_package : find a required package, can not be disabled
# find_suggested_package : find a suggested package - required but can be disabled
# find_optional_package : find an optional package - required only if enabled
# #
#============================================================================= #=============================================================================
@ -20,15 +23,29 @@
# limitations under the License. # limitations under the License.
#============================================================================= #=============================================================================
macro(find_required_package _normal_package)
find_package(${_normal_package} REQUIRED)
endmacro(find_required_package)
macro(find_suggested_package _normal_package)
string(TOUPPER ${_normal_package} _upper_package)
option(WITH_${_upper_package} "Add dependency to ${_normal_package} - recommended" ON)
if(NOT WITHOUT_${_upper_package})
message(STATUS "Finding suggested package ${_normal_package}.")
message(STATUS " Disable this using \"-DWITH_${_upper_package}=OFF\".")
find_package(${_normal_package} REQUIRED)
endif(NOT WITHOUT_${_upper_package})
endmacro(find_suggested_package)
macro(find_optional_package _normal_package) macro(find_optional_package _normal_package)
STRING(TOUPPER ${_normal_package} _upper_package) string(TOUPPER ${_normal_package} _upper_package)
OPTION(WITH_${_upper_package} "Force dependencies to ${_normal_package}" OFF) option(WITH_${_upper_package} "Add dependency to ${_normal_package}" OFF)
OPTION(WITHOUT_${_upper_package} "Never depend on ${_normal_package}" OFF)
if(WITH_${_upper_package}) if(WITH_${_upper_package})
find_package(${_normal_package} REQUIRED) find_package(${_normal_package} REQUIRED)
elseif(NOT WITHOUT_${_upper_package}) else(WITH_${_upper_package})
find_package(${_normal_package}) message(STATUS "Skipping optional package ${_normal_package}.")
message(STATUS " Enable this using \"-DWITH_${_upper_package}=ON\".")
endif(WITH_${_upper_package}) endif(WITH_${_upper_package})
endmacro(find_optional_package) endmacro(find_optional_package)

View File

@ -29,7 +29,7 @@ set(FREERDP_KBD_SRCS
add_library(freerdp-kbd SHARED ${FREERDP_KBD_SRCS}) add_library(freerdp-kbd SHARED ${FREERDP_KBD_SRCS})
find_package(XKBFile) find_suggested_package(XKBFile)
if(XKBFILE_FOUND) if(XKBFILE_FOUND)
add_definitions(-DWITH_XKBFILE) add_definitions(-DWITH_XKBFILE)
include_directories(${XKBFILE_INCLUDE_DIRS}) include_directories(${XKBFILE_INCLUDE_DIRS})

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
set(CMAKE_THREAD_PREFER_PTHREAD) set(CMAKE_THREAD_PREFER_PTHREAD)
find_package(Threads REQUIRED) find_required_package(Threads)
set(FREERDP_UTILS_SRCS set(FREERDP_UTILS_SRCS
args.c args.c