[Cmake] FindPackage + UsePackage

Bitter, Ingmar (NIH/CC/DRD) IBitter at cc.nih.gov
Tue Apr 8 13:45:03 EDT 2003


In that case I would not use USE_PACKAGE() in my CMakeLists.txt
USE_PACKAGE() would just make the common case fast

-Ingmar

-----Original Message-----
From: Bill Hoffman [mailto:bill.hoffman at kitware.com] 
Sent: Tuesday, April 08, 2003 11:43 AM
To: Bitter, Ingmar (NIH/CC/DRD)
Cc: cmake at public.kitware.com
Subject: Re: [Cmake] FindPackage + UsePackage

It should be something like this:

FIND_PACKAGE(Qt)
IF(QT_FOUND)
   INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
   LINK_LIBRARIES ( ${QT_LIBRARIES} )
ENDIF(QT_FOUND)


The problem is that with some packages, you do not want to link
in all the libraries, so what would a USE_PACKAGE do in that case?

-Bill


At 11:32 AM 4/8/2003, Bitter, Ingmar (NIH/CC/DRD) wrote:
>Hi,
>
>It seems to use a library the following is standard CMake code:
>
>FIND_PACKAGE(Qt)
>IF(QT_INCLUDE_DIR)
>  IF(QT_QT_LIBRARY)
>    INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
>    LINK_LIBRARIES ( optimized qt-mt312 optimized qtmain 
>                         debug qt-mtd       debug qtmaind)
>    LINK_DIRECTORIES( ${QT_LIBRARY_PATH} )
>  ENDIF(QT_QT_LIBRARY)
>ENDIF(QT_INCLUDE_DIR)
>
>This means that one has to remember the library names each time a new local
>project is setup and the IF cascade clutters the CMakeList.txt file.
>
>I had temporarily modified the FindQT.cmake file, such that it
automatically
>included the library and set the path. Then including many libraries looks
>clean:
>
>#setup system libraries
>FIND_PACKAGE(Ctn)
>FIND_PACKAGE(VGL)
>FIND_PACKAGE(ITK)
>FIND_PACKAGE(Qt)
>FIND_PACKAGE(Coin)
>FIND_PACKAGE(OpenGL)
>FIND_PACKAGE(Explorer)
>FIND_PACKAGE(GLsdk)
>
>But it cased problems with standard packages expecting the default versions
>of FindXYZ.cmake.
>
>Could a new function UsePackage(XYZ) be added to CMake that would call the
>appropriate UseXYZ.cmake file ?  Then CMakeLIst.txt could look nice again:
>
>#setup system libraries
>FIND_PACKAGE(Ctn)       UsePackage(Ctn)
>FIND_PACKAGE(VGL)       UsePackage(VGL)
>FIND_PACKAGE(ITK)       UsePackage(ITK)
>FIND_PACKAGE(Qt)        UsePackage(Qt)
>FIND_PACKAGE(Coin)      UsePackage(Coin)
>FIND_PACKAGE(OpenGL)    UsePackage(OpenGL)
>FIND_PACKAGE(Explorer)  UsePackage(Explorer)
>FIND_PACKAGE(GLsdk)     UsePackage(GLsdk)
>
>-Ingmar
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake 





More information about the CMake mailing list