[CMake] Writing platform check

Rajika Kumarasiri rajika at wso2.com
Tue Nov 4 21:03:56 EST 2008


hello every body,
I was trying to generate and use a config.h file from a very simple
config.h.in file for cross compilation of my software, cmake gave me the
following error. I was reading the guide here[1]. 


-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/lib/ccache/gcc
-- Check for working C compiler: /usr/lib/ccache/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for include files HAVE_MALLOC_H
-- Looking for include files HAVE_MALLOC_H - found
-- Looking for include files HAVE_SYS_MOUNT_H
-- Looking for include files HAVE_SYS_MOUNT_H - found
CMake Error: Could not open file for write in copy
operation /util/include/config.h.tmp
CMake Error: : System Error: No such file or directory
CMake Error at util/CMakeLists.txt:9 (CONFIGURE_FILE):
  configure_file Problem configuring file

CMake looks for a file named config.h.tmp which is not actually not
there cause the problem. My CMakeLists.txt in /util and my simple
config-util.h.in  /util/include is as follows.

CMakeLists.txt
--------------

ADD_SUBDIRECTORY(src)

INCLUDE (CheckIncludeFiles)

CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES ("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H)

CONFIGURE_FILE(${TEST_SOURCE_DIR}/util/include/config-util.h.in
${TEST_SOURCE_DIR}/util/include/config.h)

config-util.h.in
----------------
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_SYS_MOUNT_H


Any help to fix the problem is greatly appreciated. Thanks for your time.

-Rajika



[1] - http://www.cmake.org/Wiki/CMake:How_To_Write_Platform_Checks
-- 
http://wso2.org
http://llvm.org
http://www.osdev.org



More information about the CMake mailing list