CMake Basics: Specifying Executable Output Paths

CMake Basics: Specifying Executable Output Paths

cmake_minimum_required(VERSION 3.0)project(MyProject VERSION 1.0)
# Specify the output path for the executable
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/$<CONFIG>)
# Specify the output path for dynamic libraries
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/$<CONFIG>)
# Specify the output path for static libraries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/$<CONFIG>)
set(SRC_LIST add.c subtract.c main.c)add_executable(demo01 ${SRC_LIST})

File paths and execution resultsCMake Basics: Specifying Executable Output Paths

Leave a Comment