The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=13096 ====================================================================== Reported By: sobigboy Assigned To: ====================================================================== Project: CMake Issue ID: 13096 Category: CMake Reproducibility: sometimes Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2012-04-02 09:49 EDT Last Modified: 2012-04-02 09:49 EDT ====================================================================== Summary: CMake Using Wrong Compiler Description: When both the GNU and the Sun compilers are installed on the same server, and when starting with a clean build, cMake is not always recognizing the Sun compiler setting:
SET(CMAKE_CXX_COMPILER /usr/opt/SUNWspro/bin/CC) Instead, cMake is defaulting to the GNU compiler. Steps to Reproduce: 1. Create an folder structure to support an in-source build which looks as follows: - Source - Build 2. Create a single source file called hello.cpp containing a main() function with a simple Hello output statement, and place it in the Source folder. 3. Create a CMakeLists.txt file containing the following statements: CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(CMAKE_CXX_COMPILER /usr/opt/SUNWspro/bin/CC) PROJECT(HelloWorld) ADD_EXECUTABLE(hello hello.cpp) 4. Run cMake from the Build folder using: > cmake ../ Additional Information: After installing cMake, the first test build did not use the CMAKE_CXX_COMPILER statement in the CMakeLists.txt file, and so cMake defaulted to the GNU compiler. (This behavior was not unexpected.) The next clean build included the CMAKE_CXX_COMPILER statement specifying the Sun compiler, and cMake did successfully use the Sun compiler. Subsequently, every build (some clean-some not) always included the the CMAKE_CXX_COMPILER statement specifying the Sun compiler, and for each of these builds cMake continued using the Sun compiler. At no time was the GNU compiler ever specified. (I am the only cMake user.) Several days later, beginning with a clean build, cMake mysteriously reverted back to using the GNU compiler, despite that the CMakeLists.txt still included the CMAKE_CXX_COMPILER statement specifying the Sun compiler. Once cMake began using the GNUCXX compiler, nothing could make it use the Sun compiler, including the methods recommended in the cMake FAQ. Finally, the only solution that worked was removing the GNU compiler from the Path statement in one's .profile file. After doing this, cMake began recognizing the Sun compiler in the CMAKE_CXX_COMPILER statement again. Then, as a test, I modified the .profile file and re-entered the path to the GNUCXX compiler. This caused cMake to once again ignore the CMAKE_CXX_COMPILER statement and use the GNUCXX compiler. It made no difference whether I did an in-source build or out-source build. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2012-04-02 09:49 sobigboy New Issue ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
