[CMake] 1 tricky question, 1 bug report

Denis Scherbakov denis_scherbakov at yahoo.com
Fri Mar 13 12:10:44 EDT 2009


Dear Marcel Loose,

I tried what you have suggested and it doesn't work also.
Here is what I have:

=============CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.1 FATAL_ERROR)

ADD_SUBDIRECTORY("printf")
ADD_SUBDIRECTORY("puts")
ADD_SUBDIRECTORY("forbug")

SET(MAIN_SRCS
    main.cpp)

INCLUDE_DIRECTORIES(
    printf
    puts
)

ADD_EXECUTABLE(mytest ${MAIN_SRCS})
TARGET_LINK_LIBRARIES(mytest  printf puts forbug)
=============printf/CMakeLists.txt
PROJECT(PRINTF)

SET(PRINTF_SRCS
    printf.cpp)

ADD_LIBRARY(printf ${PRINTF_SRCS})
=============puts/CMakeLists.txt
PROJECT(PUTS)

SET(CMAKE_MODULE_PATH "~/projects/cmake-small-test/puts")
INCLUDE(FindMico)

SET(PUTS_SRCS
    puts.cpp)

IF ( NOT MICO_FOUND )
  MESSAGE(FATAL_ERROR "MICO Corba not found.")
ENDIF ()

ADD_LIBRARY(puts ${PUTS_SRCS})
=============/usr/bin/cmake-2.6.3 ~/projects/cmake-small-test/
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at puts/CMakeLists.txt:10 (MESSAGE):
  MICO Corba not found.


-- Configuring incomplete, errors occurred!
=============

As I already wrote, my problem is that "IF ( NOT MICO_FOUND )" code is executed too early - during compilation by cmake, not when user types "gmake puts" and it becomes clear that MICO is needed.

Denis


      


More information about the CMake mailing list