blt icon indicating copy to clipboard operation
blt copied to clipboard

C test enabled without checking if C is an enabled language

Open white238 opened this issue 2 years ago • 1 comments

https://github.com/LLNL/blt/blob/a7f0a6ecc4fdfa1724399b1454c3909b9ee02e81/tests/smoke/CMakeLists.txt#L211-L218

There should be a guard around this so that it is not turned on if C is not an enabled language.

white238 avatar Oct 10 '23 22:10 white238

@white238 I've recently run into this issue for some of my pure C++ libraries I manage when I moved to newer versions of BLT and my HIP testing of them. Would you be open to accepting a patch for the v0.6.x release branch that fixes this bug by adding a guards around it by something like this in BLTOptions.cmake:

set(_c_already_enabled FALSE)
foreach(enabled_langs IN LISTS _languages)
   string(COMPARE EQUAL "${enabled_langs}" "C" _c_already_enabled)
   if (_c_already_enabled)
    break()
   endif()
endforeach()

and then around the above:

    if(_c_already_enabled)
            blt_add_executable(NAME blt_hip_runtime_c_smoke
                        SOURCES blt_hip_runtime_c_smoke.c
                        OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY}
                        DEPENDS_ON blt::hip_runtime
                        FOLDER blt/tests )

        blt_add_test(NAME blt_hip_runtime_c_smoke
                    COMMAND blt_hip_runtime_c_smoke)
    endif()

Since,I'm not the best cmake person, it might need more refining, but I've found that at least in my local testing of an SNLS branch with the above patch in v0.6.2 of BLT that this fixes the cmake failures I was seeing on my HIP builds.

Also, it appears that GTest does require a C compiler, so I still need to supply a C compiler in places even if my project is purely C++ :/

rcarson3 avatar Jul 27 '24 00:07 rcarson3