On 20/05/2017 13:32, Urs Thuermann wrote:
Yes, but not directly. The executable depends on the object file, and
the object file depends on the (created) source file. Since "depends
on" is transitive, the executable also depends on the source file.
Still, I would prefer to write add_executable(f
Hendrik Sattler writes:
> >IMO that feels just wrong. foo.c does NOT depend on tab.h, foo.c does
> >not depend on anything, it's not even generated by the build system.
> >*I* edit it. Instead, it is the object file foo.o that depends on
> >tab.h.
> This is not quite correct.
Obviously, we ha
Am 20. Mai 2017 11:16:54 MESZ schrieb Urs Thuermann :
>Craig Scott writes:
>> add_executable(foo foo.c)
>> set_source_files_properties(foo.c PROPERTIES OBJECT_DEPENDS
>> ${CMAKE_BINARY_DIR}/tab.h)
>
>IMO that feels just wrong. foo.c does NOT depend on tab.h, foo.c does
>not depend on an
On Sat, May 20, 2017 at 7:16 PM, Urs Thuermann
wrote:
> Craig Scott writes:
>
> > Another choice is to set the OBJECT_DEPENDS property on foo.c, even
> though
> > the documentation for that source property says it shouldn't be needed.
> The
> > OBJECT_DEPENDS property sets up a dependency betwee
Craig Scott writes:
> This property need not be used to specify the dependency of a source file
> on a generated header file that it includes. Although the property was
> originally introduced for this purpose, it is no longer necessary. If the
> generated header file is created by a custom comma
Michael Ellery writes:
> https://github.com/mellery451/gen_header
>
> works for with me with makefile generator.
Yes, that's similar to what I have found yesterday after my posting.
It works but I'd prefer not to have to add the dependency to the
add_executable() specification.
I am new to cma
Okay you got me curious so I did some further digging and testing.
Michael's example works because the generated header is listed as a source
file in the add_executable() call. Therefore CMake automatically sets up
the required dependency for you. If you don't want to do that, two other
approaches
> Hm, it's the same info I've already found in other places.
> Unfortunately, I still don't see a way to generate a source file that
> should be #include'd instead of linked into an executable.
I missed that you wanted a .h file that other libraries would pick up. Since
CMake isn't aware of whi
> On May 19, 2017, at 3:48 PM, Urs Thuermann wrote:
>
> Craig Scott writes:
>
>> A bit of a long-shot, have you tried generating the file with the extension
>> .h instead of .c? That might allow it to be picked up by the dependency
>> scanner (I don't know if it treats file extensions differen
> Is there a way to specify that foo.o depends on tab.c? For some
> reason cmake's scan does not seem to find this.
Does the following work for you? The first bit is just putting some fixed
files for convenience. The second bit is the interesting bit. In your build
directory you won't have
Craig Scott writes:
> A bit of a long-shot, have you tried generating the file with the extension
> .h instead of .c? That might allow it to be picked up by the dependency
> scanner (I don't know if it treats file extensions differently). Also, the
> add_custom_command(OUTPUT...) call needs to be
A bit of a long-shot, have you tried generating the file with the extension
.h instead of .c? That might allow it to be picked up by the dependency
scanner (I don't know if it treats file extensions differently). Also, the
add_custom_command(OUTPUT...) call needs to be in the same CMakeLists.txt
fi
> On May 19, 2017, at 2:00 PM, Urs Thuermann wrote:
>
> Michael Ellery writes:
>
>> if your source can be generated by simple substitution of variable
>> values (like a template file), then configure_file() will do the
>> trick. If the process to create the file is more complex, then
>> add_cu
Michael Ellery writes:
> if your source can be generated by simple substitution of variable
> values (like a template file), then configure_file() will do the
> trick. If the process to create the file is more complex, then
> add_custom_command() with an appropriate OUTPUT specification is
> prob
> On May 19, 2017, at 1:00 PM, Urs Thuermann wrote:
>
> How can I write a CMakeFile that will include a generated source file
> into another C source? I have read the FAQ, searched the mailing list
> archives and have tried for two hours without success.
>
> With standard make this would be qu
How can I write a CMakeFile that will include a generated source file
into another C source? I have read the FAQ, searched the mailing list
archives and have tried for two hours without success.
With standard make this would be quite simple:
$ cat Makefile
foo: foo.o
16 matches
Mail list logo