Hi.

In our CMakeLists.txt file we want to force the user to pick a c++ compiler 
explicitly, something like this:

if (NOT DEFINED CMAKE_CXX_COMPILER)
  set(CMAKE_CXX_COMPILER $ENV{CXX})
  if (NOT DEFINED CMAKE_CXX_COMPILER)
    message(FATAL_ERROR " 
 You must choose your compiler, in one of two ways:
   cmake -DCMAKE_CXX_COMPILER=/path/to/compiler++
   CXX=/path/to/compiler++ cmake")
  endif()
endif()
message("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

Problem is, CMAKE_CXX_COMPILER is already set because cmake looked around and 
picked a compiler (which causes a lot of messages to be output before cmake 
executes the above statements).

Z% CMAKE_CXX_COMPILER=/usr/bin/clang++ cmake ..
-- The CXX compiler identification is GNU 4.9.2
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /opt/local/bin/c++
-- Check for working CXX compiler: /opt/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_CXX_COMPILER: /opt/local/bin/c++

I need a command I can put in my CMakeLists.txt file to disable the cmake 
feature that automatically locates a c++ compiler.

Thanks
-- 

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://public.kitware.com/mailman/listinfo/cmake

Reply via email to