[CMake] Setting <name>_DIR variables with Find_Package (UNCLASSIFIED)

Leiter, Kenneth (Cont, ARL/CISD) kenneth.leiter at arl.army.mil
Fri Nov 27 14:40:12 EST 2009


Classification:  UNCLASSIFIED 
Caveats: NONE
 

I am attempting to make a Find_Package command more user friendly but am
running into problems.  The package I am trying to include in my project is
Xdmf.

Currently, a user must point to <Xdmf-Install-Directory>/lib/XdmfCMake in
order to successfully find XDMFConfig.cmake.  However, some users find this
confusing and would like the ability to just point XDMF_DIR to the
<Xdmf-Install-Directory> and have some CMake logic find the correct path to
XDMFConfig.cmake.  I am having problems coming up with what I thought would
be a simple change.  I have the following after several attempts:

SET(XDMF_DIR_OLD ${XDMF_DIR})

#Include XDMF
FIND_PACKAGE(XDMF QUIET)

IF(NOT XDMF_FOUND)
  SET(XDMF_DIR ${XDMF_DIR_OLD}/lib/XdmfCMake)
  MESSAGE(${XDMF_DIR})
  FIND_PACKAGE(XDMF REQUIRED)
ENDIF(NOT XDMF_FOUND)

This almost works.  I can generate a makefile successfully when the user
inputs either  <Xdmf-Install-Directory>/lib/XdmfCMake or
<Xdmf-Install-Directory> .  However, in the latter case, XDMF_DIR in the gui
still shows the value as XDMF_DIR-NOTFOUND.  How do I get the gui to show
the properly updated path?  Does anyone know of a better way to do this?

Thanks,
Ken

---------------------------------------------------------
Kenneth Leiter
Scientific Visualization Team
Lockheed Martin / ARL DoD Supercomputing Resource Center


 
Classification:  UNCLASSIFIED 
Caveats: NONE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091127/d7afd9a8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5253 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091127/d7afd9a8/attachment.bin>


More information about the CMake mailing list