I have a CMake Project with following code snipped
find_program(DOT dot REQUIRED)
find_program(
IDL_COMPILER
NAMES idl2cpp idl2cpp.sh idl2cpp.cmd
HINTS $ENV{OE_HOME}/host/$ENV{OE_HOST_PLATFORM}/bin REQUIRED
)
# create a long text
set(TEXT 0123456789ABCDEF)
foreach(I RANGE 7)
list(APPEND TEXT ${TEXT})
endforeach()
add_custom_command(
OUTPUT generate
COMMAND ${CMAKE_COMMAND} --graphviz=${GENERATED_DIR}/${CMAKE_PROJECT_NAME}.dot ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${DOT} -Tsvg ${GENERATED_DIR}/${CMAKE_PROJECT_NAME}.dot -o ${GENERATED_DIR}/${CMAKE_PROJECT_NAME}.svg
COMMAND ${CMAKE_COMMAND} -E echo ${TEXT} > generate
COMMAND ${IDL_COMPILER} -help || echo ignored
COMMAND ${CMAKE_COMMAND} -E echo OK
COMMENT "generates generate"
)
add_custom_target(gen DEPENDS generate)
If the command are longer than an unknown limit (about 8k) a batch file is generated from CMake
.
But the IDL_COMPILER
program may be a program, a bat, or a shell wrapper depending on the build host.
following happens on windows:
$ ninja generate -v
[1/1] CMakeFiles\generate-24cacf5.bat 769e14510ca1803e
-- Configuring done
-- Generating done
Generate graphviz: C:/Users/klein_cl/Workspace/CmakeCustomTargetExamples/build/ppcIntegrity178BOrbExpressD/.generated/MyProj.dot
Reading GraphViz options file: C:/Users/klein_cl/Workspace/CmakeCustomTargetExamples/CMakeGraphVizOptions.cmake
-- Build files have been written to: C:/Users/klein_cl/Workspace/CmakeCustomTargetExamples/build/ppcIntegrity178BOrbExpressD
Usage is: idl2cpp [-help | options] input-file
-a Generate typecodes & type Any support for user-defined IDL types [default=false]
-bm Generate MSVC++ V6 and prior bug-compatible code (not for V7 and later) [default=false]
-bo Generate g++ 2.7 bug-compatible code [default=false]
-d<sym> Define pre-processor symbol <sym>
-ea Generate servant to require only impls with _env arg [default=true]
-ee Generate servant to allow impls both with and without _env arg [default=false]
-ex Generate servant to require only impls without _env arg [default=false]
-fi<n> Set formatting indent to <n> spaces [default=4]
-fm<n> Set formatting margin to column <n> [default=80]
-fc<sfx> Set client file suffix to <sfx> [default=]
-fs<sfx> Set server file suffix to <sfx> [default=_s]
-fh<ext> Set C++ header file extension to <ext> [default=h]
-fx<ext> Set C++ source file extension to <ext> [default=cxx]
-i<dir> Search <dir> for #included files
-m Map IDL modules to C++ namespaces [default=false]
-n Generate code for #included files [default=false]
-pl Use POA policies on local invocations [default=false]
-q Don't generate model _impl files [default=false]
-r Generate client code only, implies -q [default=false]
-s Syntax and semantic check only [default=false]
-ts<size> Allocate temporaries larger than size on heap instead of stack [default=1000000]
-u<sym> Undefine pre-processor symbol <sym>
-od<dir> Specify the output directory
-v Print version number and license info
-help Print this message
ignored
NO OK? This is an error in the generated batch file because call to cmd file is not used!
Q: Any idea how this can be solved a portable way?
Q: What is the MAX command length, after that, a batch file is generated?
Q: Is this a windows
specifically problem or a general ninja generator
problem?