automatak / ser4cpp

Safe low-level serializations routines for C++
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Sources for header-only targets? #1

Open jadamcrain opened 6 years ago

jadamcrain commented 6 years ago

https://github.com/automatak/ser4cpp/blob/b8649f59b3da24aff5b1e642d8ca90f7524cd2e7/src/CMakeLists.txt#L24

Looks like people have gone round and round on this issue w/ no resolution:

http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/13636

emgre commented 6 years ago

Yes, that's exactly what I have found. The target_sources command can help by adding the sources to the consuming target, but it's not super nice in Visual Studio. What would have been cool is a target_sources with PRIVATE instead of INTERFACE, but it's not possible at the moment. I understand why, INTERFACE targets do not have a project created for them in Visual Studio, otherwise VS will complain that the project has nothing to build.

I left the sources list and this in comment. If a solution is ever found in CMake, it will be there. For now, it's not a big issue since it only affects the development experience on Visual Studio and probably XCode or some other IDEs. With CLion or with a basic text editor, the files are there.