Re: [CMake] Generating include files

2017-05-19 Thread Craig Scott
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

[CMake] rpath linker args

2017-05-19 Thread Michael Ellery
I’m wondering if anyone knows the details of rpath linker args. In particular, I have two paths in my CMAKE_BUILD_RPATH. On macOS, I end-up with something like this: …. -Wl,rpath=/path/number/one -Wl,rpath=/path/number/two …. and on linux with the same CMakeLists.txt file, I get: …. -Wl,rpath

Re: [CMake] Generating include files

2017-05-19 Thread Andrew Fuller
> 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

Re: [CMake] Generating include files

2017-05-19 Thread Michael Ellery
> 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

Re: [CMake] Generating include files

2017-05-19 Thread Andrew Fuller
> 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

Re: [CMake] Generating include files

2017-05-19 Thread Urs Thuermann
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

Re: [CMake] Release build from bootstrap?

2017-05-19 Thread Craig Scott
Yes you can pass extra CMake options on the bootstrap command line. Appending the following should do the trick: ../cmake/bootstrap -- -DCMAKE_BUILD_TYPE=Release You can get full help on the bootstrap options by giving it the --help option: ../cmake/bootstrap --help On Sat, May 20, 2017 at 7

[CMake] Release build from bootstrap?

2017-05-19 Thread David Doria
When I run 'bootstrap' followed by 'make' on a cmake source tree, I get a debug build of the 'cmake' binary. If I have an existing CMake available, I can build cmake by setting CMAKE_BUILD_TYPE=Release and I end up with a release build of the new CMake. Is it possible to get a release build directl

Re: [CMake] Generating include files

2017-05-19 Thread Craig Scott
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

Re: [CMake] Generating include files

2017-05-19 Thread Michael Ellery
> 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

Re: [CMake] Generating include files

2017-05-19 Thread Urs Thuermann
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

Re: [CMake] Generating include files

2017-05-19 Thread Michael Ellery
> 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

[CMake] Generating include files

2017-05-19 Thread Urs Thuermann
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