Home > Software engineering >  How do I tell CMake to link the C standard library, not the C one?
How do I tell CMake to link the C standard library, not the C one?

Time:05-30

I have a simple C file, but I do not want to use the C standard library, just the C one. Can this be done using CMake? Basically disabling access to the c headers, and only allowing linking to the C standard.

CodePudding user response:

You can use target_compile_options(yourprog PRIVATE -nostdinc ) for clang and GCC based toolchains and /X with the path to its STL headers with msvc

  • Related