cmake check_source_runs examples

Signatures

check_source_runs(<lang> <code> <resultVar>
  [SRC_EXT <extension>])

Examples

WerWolv/ImHex lib/trace/CMakeLists.txt :33

check_source_runs(CXX "
            #include <stacktrace>
            int main() {
                auto stacktrace = std::stacktrace::current();
            }
        " HAVE_STDCPPEXP)

pytorch/FBGEMM cmake/modules/FindAVX.cmake :83

CHECK_SOURCE_RUNS(${lang} "${${type}_CODE}" ${lang}_HAS_${type}_${__FLAG_I})

longturn/freeciv21 cmake/FreecivDependencies.cmake :164

check_source_runs(CXX [[
      #include <QMediaFormat>
      int main() {
        auto fmt = QMediaFormat(QMediaFormat::Ogg);
        fmt.setAudioCodec(QMediaFormat::AudioCodec::Vorbis);
        return fmt.isSupported(QMediaFormat::Decode) ? 0 : 1;
      }
      ]]
      HAVE_OGG_VORBIS)

glKarin/com.n0n3m4.diii4a Q3E/src/main/jni/deplibs/fluidsynth/cmake_admin/FindSndFile.cmake :103

check_source_runs(
      C
      "#include <stdlib.h>
#include <sndfile.h>
int main() {
  SF_FORMAT_INFO info = {SF_FORMAT_VORBIS};
  sf_command(NULL, SFC_GET_FORMAT_INFO, &info, sizeof info);
  return info.name != NULL ? EXIT_SUCCESS : EXIT_FAILURE;
}"
      SNDFILE_SUPPORTS_VORBIS)

FluidSynth/fluidsynth cmake_admin/FindSndFileLegacy.cmake :104

check_source_runs(
      C
      "#include <stdlib.h>
#include <sndfile.h>
int main() {
  SF_FORMAT_INFO info = {SF_FORMAT_VORBIS};
  sf_command(NULL, SFC_GET_FORMAT_INFO, &info, sizeof info);
  return info.name != NULL ? EXIT_SUCCESS : EXIT_FAILURE;
}"
      SNDFILE_SUPPORTS_VORBIS)