File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,7 +501,22 @@ function(MFC_SETUP_TARGET)
501501 # exist. We use a wrapper script as RULE_LAUNCH_COMPILE that runs
502502 # the compiler and then touches the expected .o output file.
503503 set (_ipo_wrapper "${CMAKE_BINARY_DIR } /${ARGS_TARGET} _extract_wrapper.sh" )
504- file (WRITE "${_ipo_wrapper} " "#!/bin/sh\n\" $@\"\n for arg; do :; done\n touch \" $arg\"\n " )
504+ file (WRITE "${_ipo_wrapper} " [=[ #!/bin/sh
505+ # Find the -o argument (the object file CMake expects)
506+ out=
507+ prev=
508+ for arg do
509+ if [ "$prev" = "-o" ]; then out="$arg"; break; fi
510+ prev="$arg"
511+ done
512+ # Run the compiler; propagate its exit status on failure
513+ "$@"
514+ status=$?
515+ [ "$status" -eq 0 ] || exit "$status"
516+ # Touch the .o so CMake's dependency tracking sees it
517+ [ -n "$out" ] && touch "$out"
518+ exit 0
519+ ]=] )
505520 file (CHMOD "${_ipo_wrapper} " PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
506521 add_library (${ARGS_TARGET} _lib OBJECT ${ARGS_SOURCES} )
507522 set_target_properties (${ARGS_TARGET} _lib PROPERTIES
You can’t perform that action at this time.
0 commit comments