Created
September 22, 2020 11:26
-
-
Save meehatpa/f13aeb0bc9569ac42503e8bd669cfbd5 to your computer and use it in GitHub Desktop.
Sample CMakeLists.txt to use add_custom_command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.16) | |
project(testcmake) | |
# Build only when gen.g gets modified | |
add_custom_command( | |
OUTPUT ${PROJECT_SOURCE_DIR}/gen | |
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_SOURCE_DIR}/gen | |
DEPENDS "${PROJECT_SOURCE_DIR}/gen.g" | |
) | |
add_custom_target(customtarget ALL DEPENDS gen) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment