[CMake] CHECK_C_SOURCE_COMPILES and include_directories

Florian Weimer fw at deneb.enyo.de
Sun May 10 07:09:37 EDT 2015


I have this in my CMakeLists.file:

| find_path (
|   NSS_INCLUDE_DIR pk11pub.h
|   PATH_SUFFIXES include/nss include/nss3
| )
| 
| find_path (
|   NSPR_INCLUDE_DIR prtypes.h
|   PATH_SUFFIXES include/nspr include/nspr4
| )
| 
| find_path (
|   PQ_INCLUDE_DIR libpq-fe.h
|   PATH_SUFFIXES include include/postgresql
| )
|
| include_directories (
|   ${PROJECT_SOURCE_DIR}/include
|   ${NSS_INCLUDE_DIR}
|   ${NSPR_INCLUDE_DIR}
|   ${PQ_INCLUDE_DIR}
|   ${CMAKE_CURRENT_BINARY_DIR}
| )
| 
| CHECK_C_SOURCE_COMPILES ("#include <libpq-fe.h>
| int main() { PGRES_SINGLE_TUPLE; return 0; }
| "
|   HAVE_PG_SINGLE_TUPLE
| )

However, I can see that is invoked without the include directories:

/usr/bin/cc   -DHAVE_PG_SINGLE_TUPLE   -o CMakeFiles/cmTryCompileExec3118615492.dir/src.c.o   -c /home/fw/src/symboldb/build/CMakeFiles/CMakeTmp/src.c

Is there a way to make CHECK_C_SOURCE_COMPILES honor the discovered
include directories?


More information about the CMake mailing list