Hey CMake list,

I have kind of a problem with CMake (but I guess it's the strange way
I'm using it :p).

I use CMake to have a simple and consistent build system for my
cross-platform library. My library is written in C, but it also has an
optional wrapper C++ interface.

During the generation of makefiles, the user can choose whether or not
to build the C++ interface, and so I choose the appropriate language
for my library. The thing is, CMake will always fail if there is no
g++, even if the user disables the C++ interface. The code in
CMakeLists.txt looks like this(see the full file in context at [1])

[code]

# I don't add 'C' as the language, because I get build errors with g++
project(PROJECT_NAME)

# Option to build c++ interface
option(BUILD_CXX "Build the C++ interface" ON)

# Default c files
set(SOURCES list_of_c_sources.c)

# Add c++ interface if needed
if (BUILD_CXX)
    set(CXX_SOURCES list_of_cxx_sources.cxx)
    set_source_files_properties( CXX_SOURCES PROPERTIES LANGUAGE CXX )
    set(SOURCES ${SOURCES} ${CXX_SOURCES})
endif(BUILD_CXX)

[/code]

When I try to generate makefiles with: `cmake -DBUILD_CXX=OFF .....`,
the generation fails if it can't find a c++ compiler, even though it
isn't needed

I hope the *problem* is clear here, but I'm willing to provide more
information if needed. Thanks in advance.

-- Aggelos Kolaitis

[1]: 
https://bitbucket.org/sdlu/sdlu/src/79338d0f19b24c5997b87b5c318faf76627be50a/CMakeLists.txt?at=master
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to