Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

961
Vistas
How to execute a shell script using CMake post_build?

How to execute a shell script using CMake? The command that should be run is my_script that should be executed after build. The CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

project(abc)

include_directories("/usr/lib/avr/include")

set(CMAKE_CURRENT_SOURCE_DIR /home/user/Desktop)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmcu=atmega8")
set(SOURCE_FILES main.c)

add_executable(abc ${SOURCE_FILES})

#not working ----->
add_custom_command(TARGET abc
        POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E my_script
        )

DISCLAIMER

Yes, there are similar questions in SO here, here, here, etc; however, they don't give me a clear vision how this can be achieved.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You are invoking CMake with it's command-line tool mode which doesn't execute generic scripts or commands.

Instead do e.g.

add_custom_command(TARGET abc
        POST_BUILD
        COMMAND /bin/sh /path/to/my_script
        )
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda