[CMake] execute_process() and writing output to a file

Robert Dailey rcdailey at gmail.com
Thu Mar 26 14:38:54 EDT 2009


I like the idea of making it a post build event, however I'm doing certain
things that you are not that will be more difficult to support outside of
CMake.
For example, I set certain environment variables that are accessed by the
Doxyfile (This is legal in Doxygen). I'm currently doing this above my call
to execute_process():

    set( ENV{project_name} ${project_name} )
    set( ENV{include_dir} ${include_path} )
    set( ENV{source_dir} ${source_path} )
    set( ENV{dot_path} "${CMAKE_SOURCE_DIR}/tools/dot" )
    set( ENV{UNCOMMON_STRIP_PATH} ${CMAKE_SOURCE_DIR} )

How am I supposed to do this? Would I have one add_custom_command() for
each, and invoke ${CMAKE_COMMAND} with "-E environment"? What would you
recommend? Note that these environment variables aren't permanent. They only
last the lifetime of the executing process and are available to any child
processes (i.e. available to the doxygen child process. Visual Studio would
be the parent process).


On Thu, Mar 26, 2009 at 11:31 AM, Michael Jackson <
mike.jackson at bluequartz.net> wrote:

> option(MXA_BUILD_API_DOCS "Use Doxygen to create the HTML based API
> documentation" OFF)
> if(MXA_BUILD_API_DOCS)
>  FIND_PACKAGE(Doxygen)
>  if (NOT DOXYGEN_FOUND)
>    message(FATAL_ERROR "Doxygen is needed to build the documentation.")
>  endif()
>  configure_file(${MXA_RESOURCES_DIR}/MXADataModel.doxyfile.in
>                 ${MXADataModel_BINARY_DIR}/MXADataModel.doxyfile  @ONLY
> IMMEDIATE)
>  add_custom_command(TARGET ${MXADATAMODEL_LIB_NAME}
>                     POST_BUILD
>                     COMMAND ${DOXYGEN_EXECUTABLE}
> ${MXADataModel_BINARY_DIR}/MXADataModel.doxyfile)
>
> endif(MXA_BUILD_API_DOCS)
>
>
> The above is how I invoke doxygen.
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
>
> On Mar 26, 2009, at 12:23 PM, Robert Dailey wrote:
>
>  Hi,
>>
>> I've currently been running doxygen through execute_process() in CMAKE.
>> I've set it up like this:
>>
>>
>>        find_package( Doxygen REQUIRED )
>>
>>        execute_process(
>>            COMMAND "${DOXYGEN_EXECUTABLE}" "${cmake_includes}/project.dox"
>>            WORKING_DIRECTORY "${documentation_dir}"
>>            OUTPUT_FILE "${documentation_dir}/doxygen_log.txt"
>>            ERROR_FILE "${documentation_dir}/doxygen_log.txt"
>>        )
>>
>> However, this does not work. Doxygen is never run and the doxygen_log.txt
>> file has no contents. When I make OUTPUT_FILE and ERROR_FILE reference 2
>> different file names, it works fine. However, I want stderr and stdout to
>> both output to the same file in the proper order. It is important that I see
>> what "output" occurred before a specific "error", and I cannot do this if
>> they are in 2 different files.
>>
>> How can I make this work?
>> _______________________________________________
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090326/b66e569b/attachment.htm>


More information about the CMake mailing list