<br><font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">During one of my more complex migrations
from Solaris make to CMake, I have run into a problem with an argument
passed into the custom command.</font>
<br>
<br><font size=2 face="sans-serif">A key part of this project generates
CXX & HXX source files from a series of .xsd files in project
sub directories. In order to reuse this functionality if need be,
I have created a separate macro file for this task.</font>
<br>
<br><font size=2 face="sans-serif">My project is constructed with a CMakeLists.txt
file for the main project (a static library) and another CMakeLists.txt
file in one of the subdirectories containing .xsd files.</font>
<br>
<br><font size=2 face="sans-serif">My problem has to do with the ARGS section
of the custom command. Specifically the 'legacy' Makefile uses an argument
<b>--include-regex "#../../XML/Types/##"</b> in
order to remove this prefix from the generated HXX files, where applicable.</font>
<br>
<br><font size=2 face="sans-serif">While everything works fine with the
legacy Makefile, it does not seem to work in my CMake Makefile. Everything
works with the exception that some of the generated HXX files still contain
the "../../Types/" prefix, which breaks the subsequent source
compilation as the headers with the <b>"#../../XML/Types/##"</b>
prefix cannot be found by the compiler. I'm guessing that this problem
has something to do with the value being passed to the option --include-regex
is not tracking correctly but I'm not sure why.</font>
<br>
<br><font size=2 face="sans-serif">I have tried every possible permutation
of fixing this problem, going as far as including the custom command in
the body of the CMakeLists.txt file (for the subdirectory) and not using
the macro. All attempts to generate 'correct' HXX files have failed
up to this date.</font>
<br>
<br><font size=2 face="sans-serif">Is there something I'm not getting?
I will include my macro as well as the relevant information from
the calling CMakeLists.txt file below if that helps.</font>
<br>
<br><font size=2 face="sans-serif">Thanks,</font>
<br>
<br><font size=2 face="sans-serif">Eric</font>
<br>
<br><font size=2 face="sans-serif">----------- Code which invokes macro</font>
<br><font size=2 face="sans-serif">SET( STUBDIR ${CMAKE_BINARY_DIR}/Stubs
)</font>
<br><font size=2 face="sans-serif">SET( TYPE_XSD_DIR ${CMAKE_CURRENT_SOURCE_DIR}
)</font>
<br><font size=2 face="sans-serif">SET( TYPE_REGEX_FLAG "#../../XML/Types/##"
)</font>
<br>
<br><font size=2 face="sans-serif">XSDGenCXXSources( TypesOutputFiles</font>
<br><font size=2 face="sans-serif">
"${TYPE_REGEX_FLAG}"</font>
<br><font size=2 face="sans-serif">
"${TYPE_XSD_DIR}"</font>
<br><font size=2 face="sans-serif">
"${STUBDIR}"</font>
<br><font size=2 face="sans-serif">
"${CMAKE_CURRENT_SOURCE_DIR}"</font>
<br><font size=2 face="sans-serif">
)</font>
<br>
<br><font size=2 face="sans-serif">----------- Macro -----------------------------</font>
<br><font size=2 face="sans-serif">macro ( XSDGenCXXSources OUTPUT_FILES
REGEX XSD_DIR OUTPUT_DIR Working_Dir )</font>
<br>
<br><font size=2 face="sans-serif"> SET( XSD_EXE $ENV{CODE_SYNTHESIS_HOME}/bin/xsd
)</font>
<br>
<br><font size=2 face="sans-serif"> ADD_CUSTOM_COMMAND(</font>
<br><font size=2 face="sans-serif">
OUTPUT ${${OUTPUT_FILES}}</font>
<br><font size=2 face="sans-serif">
COMMAND mkdir</font>
<br><font size=2 face="sans-serif">
ARGS -p ${OUTPUT_DIR}</font>
<br><font size=2 face="sans-serif">
COMMAND ${XSD_EXE}</font>
<br><font size=2 face="sans-serif">
ARGS cxx-tree --generate-serialization --output-dir ${OUTPUT_DIR}
--include-regex " ${REGEX} " ${XSD_DIR}/*.xsd</font>
<br><font size=2 face="sans-serif">
COMMENT "Generating CXX files from ${XSD_DIR} and placing them in
${OUTPUT_DIR}"</font>
<br><font size=2 face="sans-serif">
WORKING DIRECTORY ${Working_Dir}</font>
<br><font size=2 face="sans-serif">
)</font>
<br><font size=2 face="sans-serif">endmacro ( XSDGenCXXSources )</font>
<br><font size=2 face="sans-serif">~</font>
<br>
<span style="font-family:'Arial',sans-serif; font-size:8pt; color:#000000">---</span><br>
<span style="font-family:'Courier New',monospace; font-size:10pt; color:#000000">This communication may contain confidential and/or privileged information.<br>
If you are not the intended recipient (or have received this communication<br>
in error) please notify the sender immediately and destroy this<br>
communication. Any unauthorized copying, disclosure or distribution of the<br>
material in this communication is strictly forbidden.<br>
<br>
Deutsche Bank does not render legal or tax advice, and the information<br>
contained in this communication should not be regarded as such.</span>