[CMake] 3rd party cmake files

Jan Woetzel jw at woetzelweb.de
Mon Jun 5 16:18:04 EDT 2006


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)


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


What do you think?

Jan.

-- 

  Dipl.-Ing. Jan Woetzel
--------------------------------------------------
  Uni Kiel
  Institut f. Informatik und Praktische Mathematik
  Hermann-Rodewaldstr. 3  [Raum 310]
  24098 Kiel/Germany
--------------------------------------------------
  Tel    +49-431-880-4477
  Fax    +49-431-880-4054
  Privat +49-431-802872
  Mob.   +49-179-2937346
--------------------------------------------------
  Url    www.mip.informatik.uni-kiel.de/~jw
  Email  jw at mip.informatik.uni-kiel.de
  Privat jw at WoetzelWeb.de



More information about the CMake mailing list