On 2018-02-26 14:19-0500 Michael Jackson wrote:
In our CMake based project I generate a *.cmake file which I call with the
following bit of code:
add_custom_target(DREAM3D_MKDOCS_GENERATION ALL
COMMAND "${CMAKE_COMMAND}" -P "${docsCmakeFile}"
COMMENT "using mkdocs to generate the documentation"
)
Inside the generated file is the following cmake command:
message(STATUS "Starting mkdocs execution. This can take a while.....")
execute_process(COMMAND "/path/to/mkdocs" build
OUTPUT_VARIABLE mkdocs_gen_output
RESULT_VARIABLE mkdocs_gen_result
ERROR_VARIABLE mkdocs_gen_error
WORKING_DIRECTORY
"/Users/mjackson/DREAM3D-Dev/DREAM3D-Build/Debug/Documentation/mkdocs"
)
message(STATUS "mkdocs_gen_result: ${mkdocs_gen_result}")
message(STATUS "mkdocs_gen_error: ${mkdocs_gen_error}")
message(STATUS
"**************************************************************************")
message(STATUS "mkdocs_gen_output: ${mkdocs_gen_output}")
message(STATUS
"**************************************************************************")
The issue that I am having is that if the mkdocs command fails, the build does NOT show
the failure. Is there a way to have the "cmake -P" command pick up the fact
that the cmake script failed so that the build fails or throws a warning/error?
Hi Mike:
I think you already have a good specific answer to your question, but
just out of curiosity could this CMake script approach be replaced by
executing "/path/to/mkdocs" as the COMMAND in a custom command where
your DREAM3D_MKDOCS_GENERATION custom target DEPENDS on the OUTPUT of
that custom command? Or are there reasons not to implement this more
usual custom command/custom target approach in this case?
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake