There are several options:
- Copy the executable after assembly
- Setting the output directory for your executable file (s)
Copy the executable after assembly
After a successful build, you can copy the executable file (see "Beginners Answer"), but it might be better to use the installation goal:
Use the install command to specify the goals (executables, libraries, headers, etc.) that will be copied to CMAKE_INSTALL_PREFIX . You can specify CMAKE_INSTALL_PREFIX on the cmake command line (or in the cmake GUI).
Setting the output directory for your executable file (s)
Warning: It is not recommended to set absolute paths directly in the cmakelists.txt file.
Use set_target_properties to configure RUNTIME_OUTPUT_DIRECTORY
set_target_properties( yourexe PROPERTIES RUNTIME_OUTPUT_DIRECTORY E:/parsec/bin/ )
Alternatively, changing CMAKE_RUNTIME_OUTPUT_DIRECTORY allows you to specify this for all purposes in the cmake project. Take care to change CMAKE_LIBRARY_OUTPUT_DIRECTORY when you create the DLL.
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
Additional information . Take a look at these questions:
In CMake, how do I work with Debug and Release directories, is Visual Studio 2010 trying to add?
CMake: changing the name of Visual Studio and Xcode exjectuables depending on the configuration in the project generated by CMake
How not to add Release or Debug to output the path?
Andrรฉ Nov 26 2018-12-12T00: 00Z
source share