I'm usiing a FindLibDL CMake module which, among other things, determines some boolean value regarding underscores:
# ...
CHECK_C_SOURCE_RUNS("#include <dlfcn.h>
#include <stdlib.h>
void testfunc() {}
int main() {
testfunc();
if (dlsym(0, \"_testfunc\") != (void*)0) {
return EXIT_SUCCESS;
} else {
return EXIT_FAILURE;
}
}" LIBDL_NEEDS_UNDERSCORE)
mark_as_advanced(LIBDL_INCLUDE_DIRS LIBDL_LIBRARIES LIBDL_NEEDS_UNDERSCORE)
The thing is, if underscores are not needed, CMake reports a Failure for LIBDL_NEEDS_UNDERSCORE
. How can I make it so that I still determine the same value and still not reported as a Failure?