Adam B wrote:
> Hello all,
> 
> I'm relatively new to CMake but I've encountered some unexpected behavior. 
> Perhaps it's by design or perhaps it's a bug - you tell me.  The short
> story is this:
> 
> It appears that add_custom_command() is ignored if the only OUTPUT is a C
> header file (.h).  The generated makefiles do not include the custom
> command.  However, if I also list a C source file (.c) as a second output,
> the makefiles get the command.
> 
> Here's a simplified setup to reproduce the problem:
> 
> ---------project_dir/-----------
> 
>      CMakeLists.txt
>      hello.c
>      hello.h
>      update_hello_h.sh
> 
> --------CMakeLists.txt---------
> 
> cmake_minimum_required(VERSION 2.8)
> project(cmake_test)
> 
> set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM ON)  #so hello.h never
> gets cleaned away

Who cares, noone builds in the source directory anyway, hm? ;)

> add_custom_command(OUTPUT hello.h COMMAND ./update_hello_h.sh DEPENDS
> update_hello_h.sh)
> 
> add_executable(hello hello.c)

Adding hello.h here may fix your problem.


Eike
-- 

Attachment: signature.asc
Description: This is a digitally signed message part.

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to