This i probably trival, but I haven’t figured it out yet. I have a .ini file in the same directory as the source code and I want cmake to copythis inifile.ini to the directory where the .exe file is generated. This dirctory can vary depending on if I do a release or Debug build and if I do a insource or out-of-source build. I have come this far:
configure_file(${myapp_SOURCE_DIR}/src/myinifile.ini
${myapp_BINARY_DIR}/bin/${????}/myinifile.ini COPYONLY)
But I need to include bin/Debug or bin/Release in the destination path depending on the build type. Is there a cmake variable I can use that points to the actual directory where the .exe will be generated. Or what is the best way to do this.
You can get a
LOCATIONproperty to find the output path for your target. Next you can use its value inadd_custom_command:This code will automatically handle build type dependency.