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 results

Common Syntax of CMake (Mathematical Calculations)

Common Syntax of CMake (Mathematical Calculations)

Previous Highlights:CMake Hello, WorldCMake VariablesCMake Official Tutorial (Basic Project Setup)CMake Official Tutorial (Library Creation)CMake Official Tutorial (Usage Requirements)CMake Official Tutorial (Installation and Testing)CMake Common Syntax (if Statements)CMake Common Syntax (Cache Variables)CMake Common Syntax (Environment Variables) The math command in CMake is primarily used to perform simple integer mathematical operations during the build configuration phase, making … Read more