[CMake] multi-tiered config file inclusion

Hugh Sorby h.sorby at auckland.ac.nz
Sun May 30 17:58:34 EDT 2010


So this is what I put into my OpenCASCADE config file

SET( CONFIG_FILE_CONTENTS
    "\nGET_FILENAME_COMPONENT( SELF_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" 
PATH )"
    "\nINCLUDE( \${SELF_DIR}/OpenCASCADE-targets.cmake )"
    "\nGET_FILENAME_COMPONENT( OPENCASCADE_INCLUDE_DIRS 
\"\${SELF_DIR}/../../include/OpenCASCADE\" ABSOLUTE )"
    "\nSET( OPENCASCADE_LIBRARIES ${OCC_ToolKits_SPACED} )"
    "\nSET( OPENCASCADE_FOUND TRUE )"
    "\n" )

and I put this into my wxWidgets config file

SET( CONFIG_FILE_CONTENTS
    "\nGET_FILENAME_COMPONENT( SELF_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" 
PATH )"
    "\nINCLUDE( \${SELF_DIR}/wxWidgets-targets.cmake )"
    "\nGET_FILENAME_COMPONENT( wxWidgets_INCLUDE_DIRS 
\"\${SELF_DIR}/../../include\" ABSOLUTE )"
    "\nSET( wxWidgets_LIBRARIES wxexpat ${wxaui_TARGET} ${wxxrc_TARGET} 
${wxadv_TARGET} ${wxhtml_TARGET} ${wxgl_TARGET} ${wxxml_TARGET} 
${wxbase_TARGET} ${wxcore_TARGET} ${WXWIDGETS_PLATFORM_DEPENDENT_LIBS} )"
    "\nGET_FILENAME_COMPONENT( wxWidgets_wxrc_EXECUTABLE 
\"\${SELF_DIR}/../../bin/wxrc${CMAKE_EXECUTABLE_SUFFIX}\" ABSOLUTE )"
    "\nSET( wxWidgets_DEFINITIONS ${COMPILE_DEFS_SPACED} )"
    "\nSET( wxWidgets_DEFINITIONS_DEBUG ${COMPILE_DEFS_SPACED_DEBUG} )"
    "\nSET( wxWidgets_FOUND TRUE )"
    "\n" )

and my project has ths config file

    SET( CONFIG_FILE_CONTENTS
        "\nGET_FILENAME_COMPONENT( SELF_DIR 
\"\${CMAKE_CURRENT_LIST_FILE}\" PATH )"
        "\nINCLUDE( \${SELF_DIR}/${CMGUI_LIB_GROUP}-targets.cmake )"
        "\nGET_FILENAME_COMPONENT( CMGUI_INCLUDE_DIRS 
\"\${SELF_DIR}/../../include/cmgui\" ABSOLUTE )"
        "\nSET( CMGUI_LIBRARIES ${TARGET_CMGUI_LIB} 
${TARGET_CMGUI_GENERAL_LIB} ${TARGET_CMGUI_CORE_FIELDS_LIB} 
${TARGET_CMGUI_PASS_THROUGH_LIB} )"
        "\nSET( CMGUI_FOUND TRUE )"
        "\n\n" )

After thinking about this over the weekend I am thinking I might have to 
add some conditional INCLUDEs in to drag in the imported libraries from 
OpenCASCADE, wxWidgets .e.t.c.. I am not sure about this approach 
because it releies on libraries being stationary,  as an alternative I 
thought I could add a FIND_PACKAGE with a HINTS to find the config 
file.  It seems to me like I am just implementing a libtool archive file 
in CMake, not my intention but I can see the attraction in it.


Michael Hertling wrote:
> Does your library provide a config file for itself, and does this
> config file access the prerequisites' config files in some way? How do
> you forward the prerequisites' settings through your library's config
> file to the application's CMakeLists.txt? Perhaps, you could post an
> example to point out your concern in more detail.
>
> Best regards,
>
> Michael
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>   


More information about the CMake mailing list