Closed dundargoc closed 2 years ago
The project has a depedency on C++ compiler, since the test
component depends on gtest
, which is a C++ project.
Thus, if the project is set as pure-C, the test
component could not be built.
gtest
does not have a pure-C interface, so it would be hard to refacter the test
component into pure-C.
Suggestion:
If the main CMakeLists.txt
is specified as pure-C, then it shall not call ADD_SUBDIRECTORY (test)
.
test\CMakeLists.txt
shall be made a standalone project, and be built by a separate run of cmake
.
Hmm, the effort needed to fix this was much higher than I anticipated. I don't think the amount of change needed is worth the fix. Closing.
In rare cases, such as using the clang-cl compiler on Windows, the build assumes that the project is both C and C++ based and will give an error if the variable CMAKE_CXX_COMPILER isn't defined. Explicitly stating it's a C project prevents this situation.