Fix build crash on Clang by isolating lp_solve C flags#441
Open
Mohit-Lakra wants to merge 1 commit intoGeomScale:developfrom
Open
Fix build crash on Clang by isolating lp_solve C flags#441Mohit-Lakra wants to merge 1 commit intoGeomScale:developfrom
Mohit-Lakra wants to merge 1 commit intoGeomScale:developfrom
Conversation
Contributor
Author
|
Hi @vissarion , I've implemented a fix for the build crash we were seeing on Clang. It specifically isolates the lp_solve C dependency so it doesn't try to use the project's C++17 flags. I verified the fix by building the hpolytopeVolume example, and it's working smoothly now. Please review it whenever you have time! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into a build failure while trying to run some of the volume examples on my machine using Clang. It turns out that lp_solve (which is pure C) was accidentally trying to use the project-wide C++17 flags. Clang is pretty strict about this and throws an error because -std=c++17 isn't valid for C files.
I’ve updated LPSolve.cmake to make sure the lp_solve target is strictly treated as C.
What I changed:
Forced the LINKER_LANGUAGE to C for the lp_solve target.
Set the C_STANDARD to 99 so it doesn't try to inherit the C++ standard.
Added a generator expression to the compile options so that -std=c99 is only applied to C files. This effectively "shields" the dependency from any C++ flag leakage.
This should make the build process much smoother for anyone working on macOS or using newer versions of Clang.
Fixes: #440
Before :

After :
