ADD_EXECUTABLE(1-1 1-1.c)
ADD_EXECUTABLE(1-2 1-2.c)
ADD_EXECUTABLE(1-3 1-3.c)
ADD_EXECUTABLE(1-4 1-4.c)
ADD_EXECUTABLE(1-5 1-5.c)
ADD_EXECUTABLE(1-6 1-6.c)
ADD_EXECUTABLE(1-7 1-7.c)
ADD_EXECUTABLE(1-8 1-8.c)
#设置属性CMAKE_RUNTIME_OUTPUT_DIRECTORY,控制编译出的可执行文件的输出路径,这里将1.5和1.6这两个elf的输出目录设为了./exercise/
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ./exercise/)
ADD_EXECUTABLE(1.5 ./exercise/1.5.c)
ADD_EXECUTABLE(1.6 ./exercise/1.6.c)
By default the executable file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked. See documentation of the RUNTIME_OUTPUT_DIRECTORY
target property to change this location. See documentation of the OUTPUT_NAME
target property to change the <name>
part of the final file name.
https://cmake.org/cmake/help/v3.0/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html?highlight=runtime_output_directory
RUNTIME_OUTPUT_DIRECTORY
Output directory in which to build RUNTIME target files.
This property specifies the directory into which runtime target files should be built. Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory.
There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms.
This property is initialized by the value of the variable CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created.