Hi all,

I have a problem with cmake and I did not find how to solve it in the documentation.

My problem is that I have a custom_command that generate a C file and a H file. If I add another C file in a library that needs the H file (like #include "....h") it doesn't know how to generate it.

I joined a minimal test case that expose my problem.

I tried adding the H file in the library (with add_library), it works but it's not exactly what I want. I just want to had the rule not a new dependency to the library.

--
Vivien Delmon
PhD at CREATIS, Lyon
http://www.creatis.insa-lyon.fr/rio
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
ADD_CUSTOM_COMMAND(OUTPUT toto.h toto.c
    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create_totoc_totoh.sh
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(titi toto.c)
ADD_LIBRARY(tata tata.c)

Attachment: create_totoc_totoh.sh
Description: Bourne shell script

#include <toto.h>
int main()
{
    return toto();
}
_______________________________________________
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