-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake Targets carrying compiler flags #275
base: master
Are you sure you want to change the base?
Conversation
Changed most compiler flages and options to target properties
@weinrank What do you think? |
I like most of the changes and think they're useful. 👍 But some changes have unwanted side effects, for example: |
@weinrank the point of using CMake targets is, that CMake it self takes care of the compiler definitions. |
Disclaimer: I'm not a CMake professional! :) You're right, You distinguish between public and private defines. From my point of view, only If I understand the intention of your changes correctly, you want to compile/include the library independently of the programs? |
My two cents: Every preprocessor definition used for a conditional exposed in public headers needs to be publicly exposed. Alternatively, the header needs to be generated. For example, if |
As @lgrahl already mentioned all definitions appearing in the header should be public to avoid an error caused by different configurations while linking against the library. I did not want to define any definition private, since i wanted to be consistent with the current master. This is to avoid any possible errors for non public dependecies of your project or others relaying on this defines. So defining them private, as i would assume them to be, is definitely a possibility. Further more, i did not touch the Windows only definitions since i currently do not have a running Windows System to test my changes. So this commit is just a minimum change commit to enable CMake's target features. |
You're right in case of the INET6 and INET preprocessor checks in the exposed header. Any specific reason why you moved the compiler checks to the usrsctplib folder's CMakeList.txt? |
Yes, i tried to separate the programs from the library. Since the library and the programs are compiled independently, they should also be handled as real sub-projects. |
I tried the same idea of separating the programs from the library. If you agree, I'll cherry pick most of your suggested changes without your without separating the |
In this case i would suggest to keep the defines in the library directory and just make them public. Currently all properties for each program should be the same as in your original script because i defined them as public property of the target. |
In case we set all definitions public, these definitions are also set in projects which depend on the usrsctp project by including it via If that's the case, this is not my intended behaviour. If you build the library without INET/INET6 support and try to use INET/INET6 features, the library will respond with an error indicating that the address family is not supported. If you want those defines to be exposed, they should at least have an |
I think the solution, using generated headers, is a very clean way to solve the problem. |
IIRC the only define that is still used in |
Are we still needed anything from this PR or not? |
This branch is implementing cmake targets to provide a proper export of the library using cmake.
The defines needed to compile against this library are now automatically exported when using CMakes find_package().