Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,807
    • Issues 3,807
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #13208

Closed
Open
Created May 09, 2012 by Kitware Robot@kwrobotOwner

check_symbol_exists() fails when "-pedantic-errors" is added to CMAKE_C_FLAGS

This issue was created automatically from an original Mantis Issue. Further discussion may take place here.


Try with this minimal CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
include(CheckSymbolExists)

set(CMAKE_C_FLAGS "-pedantic-errors")
check_symbol_exists(fwrite stdio.h HAVE_FWRITE)

if (NOT HAVE_FWRITE)
  message(FATAL_ERROR "fwrite not available...")
endif()

One workaround is to add -pedantic-errors to more specific variables like CMAKE_C_FLAGS_DEBUG or CMAKE_C_FLAGS_RELEASE.

Edited Jan 04, 2021 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking