Reputation: 1615
I'd like to specify a post-build action that copies files to the build output directory.
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
appears to be empty.
How can I determine the output path for my generated project in my CMakeLists.txt file?
Upvotes: 1
Views: 2808
Reputation: 141930
A project has no "output". A runtime target has a "output". The "output" here should be understood as binary/executable resulting from the compilation.
CMAKE_RUNTIME_OUTPUT_DIRECTORY
initializes the RUNTIME_OUTPUT_DIRECTORY
property of a runtime target.
In case the CMAKE_RUNTIME_OUTPUT_DIRECTORY
is empty, then the target will output it's executable in CMAKE_BINARY_DIR
. So you can check if CMAKE_RUNTIME_OUTPUT_DIRECTORY
is empty, if it is, use CMAKE_BINARY_DIR
.
Upvotes: 3