Skip to content
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

Fix OpenMP check treating Clang-CL as MSVC #203

Closed
wants to merge 2 commits into from
Closed

Fix OpenMP check treating Clang-CL as MSVC #203

wants to merge 2 commits into from

Conversation

Error-mdl
Copy link

When building with Clang-CL, the OpenMP cmake test sets the flags for MSVC (/openmp:llvm). This is not a valid argument for Clang-CL and the test fails. Only setting the MSVC flags if the compiler ID isn't Clang fixes this.

@HappySeaFox
Copy link
Owner

Can we simplify the whole if() with just if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")?

@Error-mdl
Copy link
Author

Upon further testing, openMP wasn't actually getting enabled when compiling the project. Even though the arguments in OpenMP_C_FLAGS are correct (-Xclang -fopenmp), CMake tries to encapsulate both arguments in a single set of quotes which makes it invalid. Using the alternative syntax for passing normal clang arguments to clang-cl works though (/clang:-fopenmp). This seems to function correctly in my testing:

	if (MSVC)
            if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
                 set(SAIL_OPENMP_FLAGS "/clang:-fopenmp" CACHE INTERNAL "")
            else()
                set(SAIL_OPENMP_FLAGS "/openmp:llvm" CACHE INTERNAL "")
            endif()
        else()
            set(SAIL_OPENMP_FLAGS ${OpenMP_C_FLAGS} CACHE INTERNAL "")
        endif()

@HappySeaFox
Copy link
Owner

HappySeaFox commented Dec 14, 2023

@Error-mdl Thanks for the report! Could you please attach your CMakeCache.txt and compile output when CMake tries to encapsulate both arguments in a single set of quotes here: #205?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants