-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix unnecessary/restrictive public target flags #3126
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
base: master
Are you sure you want to change the base?
Conversation
|
hmm the windows-latest check is failing due to not seeing |
|
Well, my point is that things need to Just Work for client code that tries to build things. The test program is just one example of a client program that should just work without visual studio specific magic needing to be added to it. I.e. dlib is meant to be a portable cross-platform library. Clients should not need to add "oh if I'm using $XYZ compiler then I have to do ABC to make this work" |
|
Of course. My point is that the current approach actually makes dlib not portable if the initial compilation system used MSVC, but then the client doesn't (e.g., if they're using Clang). In this case, it'll break because of In the case of the failing tests check, the current approach is problematic specifically because it assumed compiler-specific details that were set at build-time (i.e.,
@davisking to clarify on this a little bit, are you saying that the client system shouldn't require any compiler-specific checks or just that the client shouldn't need to manually specify those details themselves (e.g., to cmake in CLI)? If the latter, we're on the same page and that's what I'm trying to fix. If the former, I believe that to be a false errand because flags like Please correct me if I'm missing something :) |
|
Upon investigation of the check failure: More specifically, I don't believe it should be dlib's responsibility to force the consumer to use
EDIT: As an additional alternative option, I'll also play with generator expressions to see if we can still allow |
|
(Apologies for all the comments + edits; trying to document my thinking publicly and get input if anyone has any 🙂) |
|
I'm just saying that clients of dlib should not have to set /bigobj themselves. Things should just work for them. They shouldn't have to know about this weird /bigobj thing that MSVC demands. Which concretely here means that whatever you do you can't edit the examples/CMakeLists.txt file or dlib/test/CMakeLists.txt file to do whatever it is you want to do, since those are examples of what clients of dlib have in their CMakeLists.txt files. I.e. people, for like 2 decades now, have been using dlib and making simple CMakeLists.txt files that just work on all platforms without them ever needing to add any kind of "oh but if I try to build on MSVC then add this switch" to their CMakeLists.txt files. That needs to continue to be the case. So if you can make a PR that doesn't break any existing clients (e.g. the unit tests or example programs for instance) then that would be sweet. |
Resolves #3125, where building dlib using one compiler or system and linking to a consumer using a different one is incompatible.
Key changes:
target_compile_optionsandtarget_compile_featuresfromPUBLICtoPRIVATE, preventing dlib's compile-time configuration forcing incorrect assumptions on the consumer.active_compile_optsdlib_needed_public_cflags(now nameddlib_needed_private_cflags)dlib_needed_public_ldflags(now nameddlib_needed_private_ldflags)active_compile_optsandactive_compile_opts_private(the latter no longer needs to be a separate variable)active_compile_optsno longer requires different methodologies depending on if MSVC + CMake < 3.11 are used (simpler approach)