[CMake] 3rd party cmake files

Brad King brad.king at kitware.com
Mon Jun 5 17:01:16 EDT 2006


Jan Woetzel wrote:
> Brad King wrote:
> 
>>  If it has found this file then why does it need a find script to find 
>> QtDBUS since it has just found something from the package?
> 
> 
> Brad,
> I do not agree if multiple packages/find scripts come into play because 
> each client project has to take care of cmakes internal structure.
> 
> We use FIND_PACKAGE with <Package>Config.cmake for our *major* packages 
> and are happy with some possibly "interactive" or "-D" <Package>_DIR 
> settings.
> 
> However, our >70 additional  "simple" find scripts do not belong to a 
> special package.
> Just like the CMake/Modules scripts teh y look for some external 
> libs+headers.
> They are used by many projects and canbe thought of as "installed", 
> belong to an independant cvs etc.
> 
> To use these additional find scripts
> - without "complicated" -D setting on cmake call
> - wrapping shell script etc...
> we need something as ugly as this:
> 
> 
> # environment variable should contain our additional cmake find script 
> Modules
> SET(CMAKE_MODULE_PATH $ENV{CMAKE_MODULE_PATH})
> IF(NOT CMAKE_MODULE_PATH)
>  MESSAGE(FATAL_ERROR "FATAL ERROR: Please set shell variable 
> CMAKE_MODULE_PATH to our additional CMakeModules repository.")
> ELSE(NOT CMAKE_MODULE_PATH)
>  # a user modules path is set
>  # check for at least one of our find scripts to be sure the path is no 
> crap.
>  FIND_FILE(BIAS_CMAKE_MODULE_PATH_OK FindBLAS.cmake ${CMAKE_MODULE_PATH} 
> DOC "testing CMAKE_MODULE_PATH")
>  IF (NOT BIAS_CMAKE_MODULE_PATH_OK)
>    MESSAGE(FATAL_ERROR "Your CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} is 
> invalid because FindBLAS.cmake not found. Please set shell variable 
> CMAKE_MODULE_PATH to your (cvs) CMakeModules repository.")
>  ENDIF (NOT BIAS_CMAKE_MODULE_PATH_OK)
> ENDIF(NOT CMAKE_MODULE_PATH)
> MARK_AS_ADVANCED(BIAS_CMAKE_MODULE_PATH_OK)

Exactly.  This is why I don't want the 3rd party files...users will have 
to set something like this.

> Extending cmake would be much easier and more "open"
> with an easy way to extend teh search path for FIND_PACKAGE.

What we really need is a way to make FIND_PACKAGE find the 
QtDBUSConfig.cmake file and set QtDBUS_DIR more robustly.  Then you 
would not need any FindQtDBUS.cmake file at all.  It looks like this was 
overlooked in the recent FIND_* changes.

-Brad


More information about the CMake mailing list