mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Test if variable is defined before executing GCC test
This commit is contained in:
parent
922d76cd91
commit
74d7ba276e
@ -99,14 +99,19 @@ find_package( OpenGL )
|
||||
# Allow use of non-threadsafe reference counter in cvf::Object on systems with no atomics support
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
check_c_source_compiles("int main(int argc, char **argv) {
|
||||
int a;
|
||||
__sync_add_and_fetch(&a, 1);
|
||||
__sync_fetch_and_add(&a, 1);
|
||||
__sync_sub_and_fetch(&a, 1);
|
||||
__sync_fetch_and_sub(&a, 1); }" HAVE_GCC_ATOMICS)
|
||||
if (NOT DEFINED HAVE_GCC_ATOMICS)
|
||||
check_c_source_compiles("int main(int argc, char **argv) {
|
||||
int a;
|
||||
__sync_add_and_fetch(&a, 1);
|
||||
__sync_fetch_and_add(&a, 1);
|
||||
__sync_sub_and_fetch(&a, 1);
|
||||
__sync_fetch_and_sub(&a, 1); }" HAVE_GCC_ATOMICS)
|
||||
endif()
|
||||
|
||||
if (NOT HAVE_GCC_ATOMITCS)
|
||||
if (HAVE_GCC_ATOMICS)
|
||||
message("Atomics supported")
|
||||
else()
|
||||
message("Atomics not supported")
|
||||
add_definitions(-DCVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS)
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user