KDE/kdelibs

Alexander Neundorf neundorf at kde.org
Tue Jan 31 21:23:39 CET 2006


SVN commit 504336 by neundorf:

new cmake macro OptionalFindPackage.cmake featuring the new command optional_find_package(<name>)

e.g.

optional_find_package( ZLIB)

is the same as

option(WITH_ZLIB "Search for ZLIB package" ON)
if (WITH_ZLIB)
   find_package(ZLIB)
endif (WITH_ZLIB)

This has the effect that all packages which are searched using this new command can be manually disabled
using "cmake <dir> -DWITH_<name>=OFF" (or using the cmake GUI)
This can be used to disable a package although it exists on the system.
The result <name>_FOUND can be used as usual with find_package() for further testing in the CMakeLists.txt

Alex

CCMAIL: kde-buildsystem at kde.org



 M  +14 -11    CMakeLists.txt  
 A             cmake/modules/OptionalFindPackage.cmake  
 M  +4 -1      kdecore/CMakeLists.txt  
 M  +4 -1      kdeprint/CMakeLists.txt  
 M  +5 -3      kspell2/plugins/CMakeLists.txt  
 M  +4 -2      pics/CMakeLists.txt  


--- trunk/KDE/kdelibs/CMakeLists.txt #504335:504336
@@ -20,17 +20,20 @@
 endif(WIN32)
 
 
-find_package(ZLIB)
-find_package(BZip2)
-find_package(PNG)
-find_package(OpenEXR)
-find_package(FAM)
-find_package(Jasper)
-find_package(LibArt)
-find_package(PCRE)
-find_package(OpenSSL)
-find_package(Carbon)
-find_package(DNSSD)
+include (OptionalFindPackage)
+# optional_find_package() is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
+# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
+optional_find_package(ZLIB)
+optional_find_package(BZip2)
+optional_find_package(PNG)
+optional_find_package(OpenEXR)
+optional_find_package(FAM)
+optional_find_package(Jasper)
+optional_find_package(LibArt)
+optional_find_package(PCRE)
+optional_find_package(OpenSSL)
+optional_find_package(Carbon)
+optional_find_package(DNSSD)
 
 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
 link_directories(${KDE4_LIB_DIR})
--- trunk/KDE/kdelibs/kdecore/CMakeLists.txt #504335:504336
@@ -4,7 +4,10 @@
 
 include_directories( ${CMAKE_SOURCE_DIR}/kdefx ${CMAKE_SOURCE_DIR}/kdecore/network ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}  )
 
-find_package(AGG)
+# you can find optional_find_package() in kdelibs/cmake/modules/OptionalFindPackage.cmake
+# it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
+# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
+optional_find_package(AGG)
 if (AGG_FOUND)
    set(kdesvgicons_STAT_SRCS svgicons/ksvgiconengine.cpp svgicons/ksvgiconpainter.cpp )
    include_directories(${AGG_INCLUDE_DIR})
--- trunk/KDE/kdelibs/kdeprint/CMakeLists.txt #504335:504336
@@ -1,6 +1,9 @@
 kde4_header()
 
-find_package(Cups)
+# you can find optional_find_package() in kdelibs/cmake/modules/OptionalFindPackage.cmake
+# it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
+# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
+optional_find_package(Cups)
 
 add_subdirectory( management )
 add_subdirectory( lpdunix )
--- trunk/KDE/kdelibs/kspell2/plugins/CMakeLists.txt #504335:504336
@@ -1,12 +1,14 @@
 kde4_header()
 
-find_package(ASPELL)
+# you can find optional_find_package() in kdelibs/cmake/modules/OptionalFindPackage.cmake
+# it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
+# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
+optional_find_package(ASPELL)
 if (ASPELL_FOUND)
    add_subdirectory( aspell )
 endif (ASPELL_FOUND)
 
- 
-find_package(HSPELL)
+optional_find_package(HSPELL)
 if (HSPELL_FOUND)
    add_subdirectory( hspell )
 endif (HSPELL_FOUND)
--- trunk/KDE/kdelibs/pics/CMakeLists.txt #504335:504336
@@ -6,8 +6,10 @@
 
 include_directories( ${CMAKE_SOURCE_DIR}/kdecore/svgicons ${CMAKE_SOURCE_DIR}/kdefx ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}  )
 
-
-find_package(AGG)
+# you can find optional_find_package() in kdelibs/cmake/modules/OptionalFindPackage.cmake
+# it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
+# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
+optional_find_package(AGG)
 if (AGG_FOUND)
    	set(ksvgtopng_SRCS ksvgtopng.cpp )
 	kde4_automoc(${ksvgtopng_SRCS})


More information about the Kde-buildsystem mailing list