J
J
jov2012-08-30 07:03:42
C++ / C#
jov, 2012-08-30 07:03:42

Alternative for AC_CHECK_HEADERS in CMake

Now I'm trying to transfer the project from Autoconf to CMake. A number of questions have arisen.
1. What to do with view designs

AC_CHECK_HEADERS(stdio.h stdlib.h string.h)
okay, just make a few calls like
check_include_file("stdio.h" HAVE_STDIO_H)
And here's how to deal with
с AC_CHECK_HEADERS(resolv.h, [], [], [
#ifdef HAVE_SYS_TYPES_H
#  include <sys/types.h>
#endif
])
remains a question for me. If I understand the autoconf documentation correctly, the fourth parameter is the instructions to the preprocessor that it must include in the test file before the one passed first. Please explain to the layman in this area, otherwise I can’t figure it out.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
asl, 2012-08-30
@jov

If you believe the documentation (http://www.vtk.org/Wiki/CMake:How_To_Write_Platform_Checks), then you need to do something like this:
CHECK_INCLUDE_FILES("sys/types.h;resolv.conf" HAVE_RESOLV_CONF)
For more complex things (for example, not just including other includes before), you will need to write your own module for cmake... Well, besides, there is also the CMAKE_EXTRA_INCLUDE_FILES variable.

I
ixSci, 2012-08-30
@ixSci

You would describe what you want to achieve. Not everyone who knows CMake knows Autoconf and not everything that is in Autoconf (I believe) directly correlates with the functionality of CMake

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question