[cmake-developers] why does the order of the options in file(GENERATE) matter?

Erik Sjölund erik.sjolund at gmail.com
Fri Dec 5 04:28:43 EST 2014


I tried this out:

file(GENERATE INPUT ${CMAKE_CURRENT_SOURCE_DIR}/script.sh OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/script.sh)

but CMake failed with this error message:
"file Incorrect arguments to GENERATE subcommand."

If I reverse the order of the options INPUT and OUTPUT it works just fine.

file(GENERATE  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/script.sh) INPUT
${CMAKE_CURRENT_SOURCE_DIR}/script.sh)

The CMake documentation doesn't mention that the order matters:
http://www.cmake.org/cmake/help/v3.1/command/file.html#command:file

Why does the order of the options in file(GENERATE) matter?

cheers,
Erik Sjölund


More information about the cmake-developers mailing list