I am building with cmake + gnu c/c++ (MINGW) under Windows 10. I use add_custom_command to let a program (the name is ‘fluid’) to compiler some other resource files. Like this:
add_custom_command(
OUTPUT “${basename}.cxx” “${basename}.h”
COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
DEPENDS ${src}
MAIN_DEPENDENCY ${src}
)
The program is built by that project.
add_subdirectory(fluid)
set(FLTK_FLUID_EXECUTABLE fluid)
set(FLUID fluid) # export
It says: " If COMMAND specifies an executable target name (created by the add_executable() command), it will automatically be replaced by the location of the executable created at build time if either of the following is true:"
The problem I have is that the program is replaces in an relative path, something like this: …/myfolde/fluid.exe, but this can’t be executed in a DOS terminal.
My question is how can I let it in absolute path way?
The use of / or \ in the generated build system depends on what generator is being used. It corresponds to whatever direction is preferred by the corresponding make tool and its shell.
That probably is the problem. That should work under a Cygwin environment (with a Cygwin build of CMake), but the NMake Makefiles may also work better? The Ninja generator is probably your best bet though.