View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013096CMakeCMakepublic2012-04-02 09:492016-06-10 14:31
Reportersobigboy 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilitysometimes
StatusclosedResolutionmoved 
PlatformSunOSSolarisOS Version5.10
Product VersionCMake 2.8.7 
Target VersionFixed in Version 
Summary0013096: CMake Using Wrong Compiler
DescriptionWhen 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 Reproduce1. 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 InformationAfter 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.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0030387)
David Cole (manager)
2012-08-11 21:35

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0030969)
Rolf Eike Beer (developer)
2012-09-09 10:52

Don't set the compiler from within the CMakeLists.txt, and especially not after the project command. Use:

CXX=/usr/opt/SUNWspro/bin/CC cmake ...
(0042016)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2012-04-02 09:49 sobigboy New Issue
2012-08-11 21:35 David Cole Status new => backlog
2012-08-11 21:35 David Cole Note Added: 0030387
2012-09-09 10:52 Rolf Eike Beer Note Added: 0030969
2016-06-10 14:28 Kitware Robot Note Added: 0042016
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team