[CMake] OS X and getline ?

Eric Noulard eric.noulard at gmail.com
Mon Apr 25 09:22:28 EDT 2011


2011/4/25 AJ ONeal <coolaj86 at gmail.com>:
> What's the preferred solution to the OS X getline problem (meaning that it
> doesn't exist in OS X's libc) when using CMake?
> ("Don't use getline" isn't an option)

I don't think this is a CMake question.
If you need getline on OS X then may be you'll have to provide an
implementation when you are compiling on OS X?
see:
http://stackoverflow.com/questions/1117108/compiling-c-code-using-gnu-c-getline-on-mac-osx

> This is my first time I've tried to compile my Linux code on OS X, so I
> don't know anything about how to specify the "do this with os xyz and do
> this with os abc" options.

In a CMakeLists.txt one usually do something like:

IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  list(APPEND SOURCES  mygetline.c)
endif()

Have a look at the Wiki entries too:
http://www.cmake.org/Wiki/CMake#Basic_Introductions
http://www.cmake.org/Wiki/CMake_HowToDoPlatformChecks


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list