cmake check_cxx_source_compiles examples

Signatures

check_cxx_source_compiles(<code> <resultVar>
  [FAIL_REGEX <regex1> [<regex2>...]])

Examples

nCine/nCine cmake/check_atomic.cmake :32

check_cxx_source_compiles("${ATOMIC32_TEST_CODE}" atomic32_test)

timi-liuliang/echo thirdparty/eigen-3.3.3/cmake/FindStandardMathLibrary.cmake :29

CHECK_CXX_SOURCE_COMPILES(
  "${find_standard_math_library_test_program}"
  standard_math_library_linked_to_automatically
)

geodynamics/aspect CMakeLists.txt :495

check_cxx_source_compiles("
#include <cstddef>
#include <dlfcn.h>

int main()
{
  void *handle = dlopen (\"somelib.so\", RTLD_LAZY);
  return handle == NULL || dlerror();
}
" HAVE_DLOPEN)

u3d-community/U3D cmake/Modules/CheckCompilerToolchain.cmake :148

check_cxx_source_compiles ("#include <type_traits>\nint main() { return std::${TYPE_TRAIT}<bool>::value; }" ${UPPERCASE_${TYPE_TRAIT}})

mgerhardy/caveexpress cmake/macros.cmake :814

check_cxx_source_compiles("${CODE}" "${_COMPILE_VAR}")

alicevision/AliceVision src/cmake/CheckCXXCompilerFlag.cmake :29

CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
     # Some compilers do not fail with a bad flag
     FAIL_REGEX "error: bad value (.*) for .* switch"       # GNU
     FAIL_REGEX "argument unused during compilation"        # clang
     FAIL_REGEX "is valid for .* but not for C\\\\+\\\\+"   # GNU
     FAIL_REGEX "unrecognized .*option"                     # GNU
     FAIL_REGEX "ignoring unknown option"                   # MSVC
     FAIL_REGEX "[Uu]nknown option"                         # HP
     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
     FAIL_REGEX "command option .* is not recognized"       # XL
     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
     FAIL_REGEX " #10159: "                                 # ICC
     )

prusa3d/PrusaSlicer cmake/modules/CheckAtomic.cmake :12

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
int main() {
  return x;
}
" ${varname})

FreeCAD/FreeCAD cMake/FindNETGEN.cmake :133

check_cxx_source_compiles("#include <cstdio>\nint main(){}" CSTDIO_INCLUDE_TRY1)

godlikepanos/anki-3d-engine ThirdParty/Sdl3/cmake/macros.cmake :319

check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)")

bambulab/BambuStudio cmake/modules/CheckAtomic.cmake :12

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
int main() {
  return x;
}
" ${varname})

SoftFever/OrcaSlicer cmake/modules/CheckAtomic.cmake :12

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
int main() {
  return x;
}
" ${varname})

anhttran/3dmm_basic lib/3rdParty/Eigen/cmake/FindStandardMathLibrary.cmake :29

CHECK_CXX_SOURCE_COMPILES(
  "${find_standard_math_library_test_program}"
  standard_math_library_linked_to_automatically
)

cadaver/turso3d ThirdParty/SDL/cmake/macros.cmake :319

check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)")

Hork-Engine/Hork-Source ThirdParty/SDL3/cmake/macros.cmake :319

check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)")

STORM-IRIT/Radium-Engine cmake/FindFilesystem.cmake :114

check_cxx_source_compiles("${code}" ${var})

RavEngine/RavEngine deps/assimp/contrib/draco/cmake/draco_flags.cmake :203

check_cxx_source_compiles("${draco_cxx_main}" linker_flag_test_passed)

AlizaMedicalImaging/AlizaMS CMakeLists.txt :327

check_cxx_source_compiles("#include <byteswap.h>\nint main(){return bswap_32(42);}" MDCM_HAVE_BYTESWAP_H)

kokkos/kokkos cmake/kokkos_arch.cmake :893

check_cxx_source_compiles(
        "
      #include <sycl/sycl.hpp>
      using namespace sycl::ext::oneapi::experimental;
      using namespace sycl;

      SYCL_EXTERNAL device_global<int, decltype(properties(device_image_scope))> Foo;

      void bar(queue q) {
        q.single_task([=] {
        Foo = 42;
      });
      }

      int main(){ return 0; }
      "
        KOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED
      )

eclipse-ecal/ecal CMakeLists.txt :60

check_cxx_source_compiles("${ATOMIC_TEST_CODE}" ATOMIC_IS_BUILTIN)

ZDoom/gzdoom src/CMakeLists.txt :180

CHECK_CXX_SOURCE_COMPILES("#include <ppl.h>
	int main() { concurrency::parallel_for(0, 1, 1, [](int) { } ); }"
	HAVE_PARALLEL_FOR)

libgme/game-music-emu gme/CMakeLists.txt :264

check_cxx_source_compiles("int main(void) { return 0;}" LINKER_SUPPORTS_NO_UNDEFINED)

ANTsX/ANTs CMake/ITKSetStandardCompilerFlags.cmake :347

CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" have_gold)

etternagame/etterna extern/fmt/support/cmake/cxx14.cmake :52

check_cxx_source_compiles("
  void operator\"\" _udl(long double);
  int main() {}"
  SUPPORTS_USER_DEFINED_LITERALS)

KDE/digikam core/cmake/modules/FindLqr-1.cmake :31

CHECK_CXX_SOURCE_COMPILES("
    #include <lqr.h>

    int main()
    {
    LqrImageType t = LQR_RGB_IMAGE;
    return 0;
    }
    " HAVE_LQR_0_4)

pcb9382/FaceAlgorithm include/Eigen/cmake/FindStandardMathLibrary.cmake :29

CHECK_CXX_SOURCE_COMPILES(
  "${find_standard_math_library_test_program}"
  standard_math_library_linked_to_automatically
)

Kitware/kwiver CMake/FindTinyXML.cmake :39

CHECK_CXX_SOURCE_COMPILES("
      #include <tinyxml.h>
      int main() { TiXmlNode *node; std::cin >> *node; } "
      TinyXML_USE_STL_D
      )

RSIA-LIESMARS-WHU/LSHBOX include/eigen/cmake/FindStandardMathLibrary.cmake :29

CHECK_CXX_SOURCE_COMPILES(
  "${find_standard_math_library_test_program}"
  standard_math_library_linked_to_automatically
)

liminchen/OptCuts ext/libigl/external/cgal/src/CGAL_Project/cmake/modules/FindTBB.cmake :76

check_cxx_source_compiles("${TBB_try_ts_source}" ${result_var})

KhronosGroup/Vulkan-Samples bldsys/cmake/check_atomic.cmake :40

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
std::atomic<short> y;
std::atomic<char> z;
int main() {
  ++z;
  ++y;
  return ++x;
}
" ${varname})

bareos/bareos core/cmake/BareosCheckFunctions.cmake :99

check_cxx_source_compiles(
  "
#include <source_location>
int main() {
 std::source_location l{};
 return 0;
}
"
  HAVE_SOURCE_LOCATION
)

facebook/folly CMake/folly-deps.cmake :187

check_cxx_source_compiles("
  #include <atomic>
  int main(int argc, char** argv) {
    std::atomic<uint8_t> a1;
    std::atomic<uint16_t> a2;
    std::atomic<uint32_t> a4;
    std::atomic<uint64_t> a8;
    struct Test { bool val; };
    std::atomic<Test> s;
    return a1++ + a2++ + a4++ + a8++ + unsigned(s.is_lock_free());
  }"
  FOLLY_CPP_ATOMIC_BUILTIN
)

mariadb-corporation/MaxScale cmake/CheckPlatform.cmake :63

check_cxx_source_compiles("
  #define _GNU_SOURCE 1
  #include <string.h>\n
  int main(){\n
      char errbuf[200];\n
      return strerror_r(13, errbuf, sizeof(errbuf)) == errbuf;\n
  }\n"
  HAVE_GLIBC)

facebook/rocksdb CMakeLists.txt :317

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<uint64_t> x(0);
int main() {
  uint64_t i = x.load(std::memory_order_relaxed);
  bool b = x.is_lock_free();
  return 0;
}
" BUILTIN_ATOMIC)

openvinotoolkit/openvino cmake/developer_package/target_flags.cmake :122

check_cxx_source_compiles("
# include <string>
# ifndef _GLIBCXX_USE_CXX11_ABI
#  error \"GlibCXX ABI is not defined\"
# endif

int main() {
  return 0;
}"
    OPENVINO_STDLIB_GNU)

lightspark/lightspark tests/test-runner/3rdparty/cpptrace/cmake/Autoconfig.cmake :8

check_cxx_source_compiles(${full_source} ${var})

gnss-sdr/gnss-sdr CMakeLists.txt :999

check_cxx_source_compiles("
        #include <string_view>
        int main()
        { std::string_view sv; }"
        has_string_view
    )

ossia/score cmake/modules/FindReadline.cmake :23

check_cxx_source_compiles("
		#include <stdio.h>
		#include <readline/readline.h>
		#if !defined(RL_VERSION_MAJOR) || !defined(RL_VERSION_MINOR)
		#error Ancient version of readline
		#endif
		int main() { return 0; }
		"
		_rl_version_check)

lizardfs/lizardfs cmake/CheckCXXExpression.cmake :43

CHECK_CXX_SOURCE_COMPILES("${_CHECK_CXX_EXPRESSION_SOURCE_CODE}" ${_RESULT})

vinipsmaker/tufao cmake/modules/FindCXX11.cmake :53

check_cxx_source_compiles("${CXX11_TEST_SOURCE}" CXX11_FLAG_DETECTED)

v6d-io/v6d cmake/CheckLinkerFlag.cmake :78

check_CXX_source_compiles("${_source}" ${_var} ${_common_patterns})

IBAMR/IBAMR CMakeLists.txt :84

CHECK_CXX_SOURCE_COMPILES(
  "
  _Pragma(\"GCC diagnostic push\")
  _Pragma(\"GCC diagnostic ignored \\\\\\\"-Wunknown-pragmas\\\\\\\"\")
  _Pragma(\"GCC diagnostic ignored \\\\\\\"-Wpragmas\\\\\\\"\")
  _Pragma(\"GCC diagnostic ignored \\\\\\\"-Wextra\\\\\\\"\")
  _Pragma(\"GCC diagnostic pop\")
  int main() {}
  "
  IBTK_HAVE_PRAGMA_KEYWORD)

w111liang222/lidar-slam-detection hardware/gstreamer/plugins/cmake/modules/FindGStreamer.cmake :123

check_cxx_source_compiles("
#define G_BEGIN_DECLS
#define G_END_DECLS
#include <gst/gstversion.h>

#if GST_CHECK_VERSION(${_comma_version})
int main() { return 0; }
#else
# error \"GStreamer version incompatible\"
#endif
" GSTREAMER_VERSION_COMPATIBLE)

TheAssemblyArmada/Thyme cmake/modules/TargetExports.cmake :15

check_cxx_source_compiles("int main(int argc, char **argv){return 0;}" HAVE_LD_VERSION_SCRIPT)

abacusmodeling/abacus-develop cmake/FindELPA.cmake :86

check_cxx_source_compiles("
#include <elpa/elpa_version.h>
#if ELPA_API_VERSION < 20210430
#error ELPA version is too old.
#endif
int main(){}
"
ELPA_VERSION_SATISFIES
)

NVIDIA/DALI cmake/modules/FindNVJPEG.cmake :53

check_cxx_source_compiles(
          "#include <nvjpeg.h>
          int main(){
            return NVJPEG_BACKEND_LOSSLESS_JPEG != 6;
          }"
          NVJPEG_LOSSLESS_SUPPORTED)

asset-group/Sni5Gect-5GNR-sniffing-and-exploitation cmake/modules/CheckAtomic.cmake :39

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
int main() {
return std::atomic_is_lock_free(&x);
}
" ${varname})

OSVR/SteamVR-OSVR src/CMakeLists.txt :21

check_cxx_source_compiles("#include <memory>\nint main(int, char**) { std::unique_ptr<int> i = std::make_unique<int>(0); }" OSVR_HAS_STD_MAKE_UNIQUE)

scanner-research/scanner cmake/Modules/FindIconv.cmake :27

check_cxx_source_compiles("
  #include <iconv.h>
  int main(){
    iconv_t conv = 0;
    const char* in = 0;
    size_t ilen = 0;
    char* out = 0;
    size_t olen = 0;
    iconv(conv, &in, &ilen, &out, &olen);
    return 0;
  }
" ICONV_SECOND_ARGUMENT_IS_CONST )

Amber-MD/cpptraj cmake-cpptraj/CheckLinkerFlag.cmake :39

check_cxx_source_compiles("int main(void) { return 0; }" ${RESULT}
			# Some compilers do not fail with a bad flag
			FAIL_REGEX "command line option .* is valid for .* but not for C++" # GNU
			${_CheckLinkerFlag_COMMON_PATTERNS})

DIPlib/diplib src/CMakeLists.txt :66

check_cxx_source_compiles("int main() { char const* name = __PRETTY_FUNCTION__; }" HAS_PRETTY_FUNCTION)

BRAINSia/BRAINSTools CMake/FindDCMTK.cmake :342

check_cxx_source_compiles("#include <dcmtk/config/osconfig.h>\n#include <dcmtk/ofstd/ofstream.h>\nint main(int,char*[]){return 0;}"
    DCMTK_HAVE_CONFIG_H_OPTIONAL
    )

Tulip-Dev/tulip cmake/FindFTGL.cmake :110

CHECK_CXX_SOURCE_COMPILES( "
           #include <OpenGL/glu.h>
           typedef GLvoid (*TF)(); 
           int main() { 
           gluTessCallback(0,GLU_TESS_END_DATA,(TF)0);
           return 1;
           }" FTGL_GLU_EMPTY)

gismo/gismo cmake/FindTR1.cmake :28

check_cxx_source_compiles(
    "
        #include <memory>
        int main() {
            std::tr1::shared_ptr<int> ptr;
            return 0;
        }
    "
    TR1_SHARED_PTR_FOUND)

trailofbits/pasta cmake/modules/FindFilesystem.cmake :117

check_cxx_source_compiles("${code}" ${var})

GoSSIP-SJTU/TripleDoggy cmake/modules/CheckAtomic.cmake :12

CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
int main() {
  return x;
}
" ${varname})

ceph/ceph cmake/modules/CephChecks.cmake :92

check_cxx_source_compiles("
  #include <string.h>
  int main() { char x = *strerror_r(0, &x, sizeof(x)); return 0; }
  " STRERROR_R_CHAR_P)

gnuradio/gnuradio cmake/Modules/FindPORTAUDIO.cmake :30

check_cxx_source_compiles(
        "#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}"
        PORTAUDIO2_FOUND)

TigerVNC/tigervnc CMakeLists.txt :307

check_cxx_source_compiles("#include <FL/Fl.H>\n#if FL_MAJOR_VERSION != 1 || FL_MINOR_VERSION != 3\n#error Wrong FLTK version\n#endif\nint main(int, char**) { return 0; }" OK_FLTK_VERSION)

apache/trafficserver CMakeLists.txt :530

check_cxx_source_compiles(
  "#include <openssl/crypto.h>
  #if __has_include(<openssl/ex_data.h>)
  #include <openssl/ex_data.h>
  #endif
  int main() {
  CRYPTO_EX_dup *cb = [] (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, void **from_d, int idx, long argl, void *argp) -> int { return 0; };
  return 0;
  }"
  HAVE_CRYPTO_EX_DUP_TYPE1
)

sddm/sddm cmake/FindPAM.cmake :34

check_cxx_source_compiles("
#if ${HAVE_PAM_PAM_APPL_H}+0
# include <pam/pam_appl.h>
#else
# include <security/pam_appl.h>
#endif

static int PAM_conv(
	int num_msg,
	const struct pam_message **msg, /* this is the culprit */
	struct pam_response **resp,
	void *ctx)
{
	return 0;
}

int main(void)
{
	struct pam_conv PAM_conversation = {
		&PAM_conv, /* this bombs out if the above does not match */
		0
	};

	return 0;
}
" PAM_MESSAGE_CONST)

dartsim/dart cmake/DARTFindDependencies.cmake :39

check_cxx_source_compiles(
  "
  #include <assimp/scene.h>
  int main()
  {
    aiScene* scene = new aiScene;
    delete scene;
    return 1;
  }
  "
  ASSIMP_AISCENE_CTOR_DTOR_DEFINED)

simbody/simbody Platform/CMakeLists.txt :30

CHECK_CXX_SOURCE_COMPILES("#include <mutex>\nint main(){std::mutex m;return 0;}" GPP_SUPPORTS_STD_MUTEX)

steemit/steem libraries/vendor/rocksdb/CMakeLists.txt :226

CHECK_CXX_SOURCE_COMPILES("
#include <cstdint>
#include <nmmintrin.h>
#include <wmmintrin.h>
int main() {
  volatile uint32_t x = _mm_crc32_u32(0, 0);
  const auto a = _mm_set_epi64x(0, 0);
  const auto b = _mm_set_epi64x(0, 0);
  const auto c = _mm_clmulepi64_si128(a, b, 0x00);
  auto d = _mm_cvtsi128_si64(c);
}
" HAVE_SSE42)

brndnmtthws/conky 3rdparty/Vc/CMakeLists.txt :147

CHECK_CXX_SOURCE_COMPILES("#include <stdexcept>
            #include <iostream>
            void foo() {
              std::cout << 'h' << std::flush << std::endl;
              throw std::exception();
            }
            int main() {
              try { foo(); }
              catch (int) { return 0; }
              return 1;
            }" libcxx_compiles)

root-project/root cmake/modules/CheckCompiler.cmake :270

check_cxx_source_compiles(
"
#include <string>
#if _GLIBCXX_USE_CXX11_ABI == 0
  #error NOCXX11
#endif
int main() {}
" GLIBCXX_USE_CXX11_ABI)

brainflow-dev/brainflow third_party/fmt/support/cmake/cxx14.cmake :52

check_cxx_source_compiles("
  void operator\"\" _udl(long double);
  int main() {}"
  SUPPORTS_USER_DEFINED_LITERALS)

toggl-open-source/toggldesktop third_party/poco/Foundation/CMakeLists.txt :123

CHECK_CXX_SOURCE_COMPILES("
		#include <sched.h>
		int main() {
			cpu_set_t cpumask;
			sched_setaffinity( 0, sizeof(cpumask), &cpumask );
			return 0;
		}" HAVE_THREE_PARAM_SCHED_SETAFFINITY)

webcamoid/webcamoid CMakeLists.txt :120

check_cxx_source_compiles("
    #ifndef __linux__
        #error Not Linux
    #endif

    int main()
    {
        return 0;
    }" IS_LINUX)

mfontanini/libtins cmake/Modules/FindPCAP.cmake :53

check_cxx_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO)

projectM-visualizer/projectm cmake/EnableCFlagsIfSupported.cmake :27

check_cxx_source_compiles("int main(){return 0;}" ${_supported_var})

google/filament third_party/abseil/CMake/AbseilDll.cmake :690

check_cxx_source_compiles(
  [==[
#ifdef _MSC_VER
#  if _MSVC_LANG < 201703L
#    error "The compiler defaults or is configured for C++ < 17"
#  endif
#elif __cplusplus < 201703L
#  error "The compiler defaults or is configured for C++ < 17"
#endif
int main() { return 0; }
]==]
  ABSL_INTERNAL_AT_LEAST_CXX17)

elemental/Elemental cmake/detect/CXX.cmake :28

check_cxx_source_compiles("${ALIAS_CODE}" EL_HAVE_TEMPLATE_ALIAS)

percona/percona-xtrabackup CMakeLists.txt :1005

CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT}
    FAIL_REGEX "unknown argument ignored"
    FAIL_REGEX "argument unused during compilation"
    FAIL_REGEX "unsupported .*option"
    FAIL_REGEX "unknown .*option"
    FAIL_REGEX "unrecognized .*option"
    FAIL_REGEX "ignoring unknown option"
    FAIL_REGEX "[Ww]arning: [Oo]ption"
    FAIL_REGEX "error: visibility"
    FAIL_REGEX "warning: visibility"
    )

seladb/PcapPlusPlus cmake/modules/FindPCAP.cmake :57

check_cxx_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO)

NREL/EnergyPlus third_party/eigen/cmake/FindStandardMathLibrary.cmake :29

CHECK_CXX_SOURCE_COMPILES(
  "${find_standard_math_library_test_program}"
  standard_math_library_linked_to_automatically
)

resiprocate/resiprocate CMakeLists.txt :87

check_cxx_source_compiles("
#include <string_view>
int main() {
    std::string_view sv = \"test\";
    return 0;
}
" RESIP_HAVE_STRING_VIEW)

mysql/mysql-server CMakeLists.txt :1008

CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT}
    FAIL_REGEX "unknown argument ignored"
    FAIL_REGEX "argument unused during compilation"
    FAIL_REGEX "unsupported .*option"
    FAIL_REGEX "unknown .*option"
    FAIL_REGEX "unrecognized .*option"
    FAIL_REGEX "ignoring unknown option"
    FAIL_REGEX "[Ww]arning: [Oo]ption"
    FAIL_REGEX "error: visibility"
    FAIL_REGEX "warning: visibility"
    )

robotology/yarp extern/thrift/thrift/build/cmake/ConfigureChecks.cmake :64

check_cxx_source_compiles(
  "
  #include <string.h>
  int main(){char b;char *a = strerror_r(0, &b, 0); static_cast<void>(a); return(0);}
  "
  STRERROR_R_CHAR_P)

katahiromz/RisohEditor mcdx/FindIconv.cmake :27

check_cxx_source_compiles("
  #include <iconv.h>
  int main(){
    iconv_t conv = 0;
    const char* in = 0;
    size_t ilen = 0;
    char* out = 0;
    size_t olen = 0;
    iconv(conv, &in, &ilen, &out, &olen);
    return 0;
  }
" ICONV_SECOND_ARGUMENT_IS_CONST )

mysql/mysql-router tests/fuzzers/CMakeLists.txt :74

check_cxx_source_compiles("extern \"C\" int LLVMFuzzerTestOneInput(void *, int) { return 0; }" CLANG_HAS_LIBFUZZER)

ebu/ear-production-suite cmake_modules/check_nng.cmake :11

CHECK_CXX_SOURCE_COMPILES(
  "#include <nng/nng.h>
  void cb(nng_pipe, nng_pipe_ev, void*) {}

  int main() {
    nng_socket s;
    nng_pipe_notify(s, NNG_PIPE_EV_ADD_PRE, cb, NULL);
  }
  " NEW_NNG_PIPE_NOTIFY_CALLBACK_SIGNATURE
)

apache/thrift build/cmake/ConfigureChecks.cmake :59

check_cxx_source_compiles(
  "
  #define WIN32_LEAN_AND_MEAN
  #include <winsock2.h>
  #include <windows.h>
  #include <afunix.h>
  int main(){(void)sizeof(((struct sockaddr_un *)0)->sun_path); return 0;}
  "
  HAVE_AF_UNIX_H)

datastax/cpp-driver src/CMakeLists.txt :110

check_cxx_source_compiles("int main() { return __builtin_bswap32(42); }" HAVE_BUILTIN_BSWAP32)

facebook/fbthrift thrift/compiler/CMakeLists.txt :21

check_cxx_source_compiles("
  #include <type_traits>
  #if _GLIBCXX_RELEASE
  int main() {}
  #endif"
  FBTHRIFT_COMPILER_STDLIB_LIBSTDCXX
)

Icinga/icinga2 CMakeLists.txt :414

check_cxx_source_compiles("class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE)

AcademySoftwareFoundation/OpenImageIO src/cmake/compiler.cmake :387

check_cxx_source_compiles(
       "#include <atomic>
        #include <cstdint>
        std::atomic<uint64_t> x {0};
        int main() {
            uint64_t i = x.load(std::memory_order_relaxed);
            return 0;
        }"
        COMPILER_SUPPORTS_ATOMIC_WITHOUT_LIBATOMIC)

KDE/qca src/CMakeLists.txt :8

CHECK_CXX_SOURCE_COMPILES("
# include <stdlib.h>
# include <sys/mman.h>
int main() { void *f = 0; return mlock(f,8); }
" MLOCK_TAKES_VOID)

boostorg/nowide CMakeLists.txt :56

check_cxx_source_compiles("${lfsSource}" BOOST_NOWIDE_HAS_LFS)

manticoresoftware/manticoresearch cmake/check_atomic_intrinsics.cmake :3

CHECK_CXX_SOURCE_COMPILES ( "
int main() {
	volatile int ia=0;
	__sync_fetch_and_or( &ia, 1 );
	return 0;
}" HAVE_SYNC_FETCH )

stephenberry/glaze tests/networking_tests/https_test/CMakeLists.txt :13

check_cxx_source_compiles("
    #include <openssl/ssl.h>
    #include <openssl/opensslconf.h>
    #include <openssl/evp.h>
    #include <openssl/x509.h>
    #include <openssl/pem.h>
    int main() { return 0; }
" OPENSSL_HEADERS_AVAILABLE)

scylladb/seastar cmake/CheckGcc107852.cmake :13

check_cxx_source_compiles ("
#include <fmt/ranges.h>

int main() {
    float grades[] = {3.14};
    fmt::print(\"{}\", grades);
}"
  Cxx_Compiler_BZ107852_Free
  FAIL_REGEX "is out of the bounds")

keepassx/keepassx CMakeLists.txt :166

check_cxx_source_compiles("
  #include <zlib.h>

  #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1200)
      #error zlib 1.2.x or higher is required to use the gzip format
  #endif

  int main() { return 0; }" ZLIB_SUPPORTS_GZIP)

pytorch/FBGEMM cmake/modules/FindGnuH2fIeee.cmake :14

CHECK_CXX_SOURCE_COMPILES("
    #include <arm_neon.h>
    int main() {
        float f = 1.0f;
        uint16_t h = __gnu_f2h_ieee(f);
        return 0;
    }
" HAVE_GNU_F2H_IEEE)

LLNL/SAMRAI cmake/CMakeConfigureFile.cmake :41

check_cxx_source_compiles("int test = std::isnan(0.0)" HAVE_ISNAN)

OSVR/OSVR-Core cmake-local/CompilerFeatures.cmake :23

check_cxx_source_compiles("#include <${HEADER}>\n int main() { ${TYPE} test; return 0;}" ${VAR})

epoupon/fileshelter cmake/modules/FindFilesystem.cmake :188

check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)

infiniflow/infinity third_party/fastpfor/cmake_modules/AppendCompilerFlags.cmake :32

check_cxx_source_compiles("int main() { return 0; }" ${have_flag})

KDE/k3b cmake/modules/FindIconv.cmake :36

check_cxx_source_compiles("
  #include <iconv.h>
  int main(){
    iconv_t conv = 0;
    const char* in = 0;
    size_t ilen = 0;
    char* out = 0;
    size_t olen = 0;
    iconv(conv, &in, &ilen, &out, &olen);
    return 0;
  }
" ICONV_SECOND_ARGUMENT_IS_CONST )

mysql/mysql-connector-cpp cdk/extra/protobuf/protobuf-3.19.6/cmake/CMakeLists.txt :169

check_cxx_source_compiles("
    #include <atomic>
    int main() {
      return std::atomic<int64_t>{};
    }
  " protobuf_HAVE_BUILTIN_ATOMICS)

AshamaneProject/AshamaneCore dep/boost/CMakeLists.txt :54

check_cxx_source_compiles("
  #include <boost/filesystem/path.hpp>
  #include <boost/filesystem/operations.hpp>
  int main() { boost::filesystem::copy_file(boost::filesystem::path(), boost::filesystem::path()); }"
boost_filesystem_copy_links_without_NO_SCOPED_ENUM)