I’m implementing a feature for a cmake-based FOSS project, but for NDA reasons it can only be publicly contributed when an embargo is lifted which probably won’t be for ~12 months.
Meanwhile, I need to keep up-to-date with the FOSS project so I’ve made a copy in my private repo of the file I’m editing and disabled that file from compiling in the FOSS submodule by making this small tweak:
set_source_files_properties(foo.c PROPERTIES HEADER_FILE_ONLY ON)
That works great, confirmed that my foo.c
is being linked rather than the FOSS one and I can get on with software development.
Now I’d like to apply this property remotely from my private repo and get back to a clean FOSS submodule so I can pull changes. I’ve identified the target name and see the FOSS file appears in the list:
get_property(nest TARGET foss__target__name PROPERTY SOURCES)
message("FOSS sources are ${nest}")
displays FOSS sources are bar.c;blech.c;foo.c;twiddle.c
But getting and setting the HEADER_FILE_ONLY property isn’t working (bearing in mind I’ve not removed my FOSS submodule tweak yet)
get_source_file_property(cuckoo foo.c TARGET_DIRECTORY foss__target__name HEADER_FILE_ONLY)
message("foo.c bypass was set ${cuckoo}")
set_property(SOURCE foo.c TARGET_DIRECTORY foss__target__name PROPERTY HEADER_FILE_ONLY ON)
displays foo.c bypass was set NOTFOUND
and the set_property doesn’t have any effect (but doesn’t fail either)
I’m using cmake 3.29.3; What am I doing wrong or is this not currently possible with cmake?
0