Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,106
    • Issues 4,106
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #17098
Closed
Open
Issue created Jul 25, 2017 by Ghost User@ghostContributor

CMake lifecyle phases

Hi guys,

I am new to CMake and tried to build my sample "hello world" app from src to final executable.
I found POST_BUILD step very useful to make executable bin from build output directly from CMake instead of using VS or etc.
But I didn't find the way to do it because no one command was triggered on POST_BUILD phase.

There is the CMakeLists.txt example:

cmake_minimum_required (VERSION 2.8)
project (sample)

set(SRC_FILES src/main.cc)

add_executable(${CMAKE_PROJECT_NAME} ${SRC_FILES})

add_custom_command(TARGET ${CMAKE_PROJECT_NAME} 
                   PRE_BUILD 
                   COMMAND echo "This is pre build" 
                  ) 
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} 
                   POST_BUILD 
                   COMMAND echo "This is post build" 
                  ) 

OS: Windows 10 x64
Compiler: MSVC 19.10.25019.0 Cmake: 3.9 v

Thanks.

Edited Jul 25, 2017 by Ghost User
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking