MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0016061 | CMake | CMake | public | 2016-04-13 11:02 | 2016-06-10 14:21 |
|
Reporter | Stefan Teleman | |
Assigned To | | |
Priority | normal | Severity | trivial | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | x86 x86_64 SPARC | OS | Solaris | OS Version | 5.11, 5.12 |
Product Version | CMake 3.5 | |
Target Version | CMake 3.6 | Fixed in Version | CMake 3.6 | |
|
Summary | 0016061: define SOLARIS and CMAKE_HOST_SOLARIS as a cmake built-in |
Description | in ${top_srcdir}/Source/cmState.cxx:
void cmState::Snapshot::SetDefaultDefinitions()
several builtins are defined: WIN32/CMAKE_HOST_WIN32, APPLE/CMAKE_HOST_APPLE,
etc.
We would like to submit this patch to add corresponding definitions
for Solaris: SOLARIS/CMAKE_HOST_SOLARIS
Proposed patch - cmState.cxx-solaris.patch - attached.
The patch is based on cmake 3.5.0.
|
Steps To Reproduce | Always - the SOLARIS/CMAKE_HOST_SOLARIS definition is not present
in cmake.
|
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | cmState.cxx-solaris.patch (565) 2016-04-13 11:02 https://public.kitware.com/Bug/file/5675/cmState.cxx-solaris.patch cmState.cxx-solaris-v2.patch (1,228) 2016-04-13 17:04 https://public.kitware.com/Bug/file/5676/cmState.cxx-solaris-v2.patch |
|
Issue History |
Date Modified | Username | Field | Change |
2016-04-13 11:02 | Stefan Teleman | New Issue | |
2016-04-13 11:02 | Stefan Teleman | File Added: cmState.cxx-solaris.patch | |
2016-04-13 11:39 | Brad King | Note Added: 0040851 | |
2016-04-13 14:08 | Stefan Teleman | Note Added: 0040852 | |
2016-04-13 14:21 | Stefan Teleman | Note Added: 0040853 | |
2016-04-13 14:24 | Brad King | Note Added: 0040854 | |
2016-04-13 14:58 | Stefan Teleman | Note Added: 0040855 | |
2016-04-13 15:10 | Brad King | Note Added: 0040856 | |
2016-04-13 15:18 | Stefan Teleman | Note Added: 0040858 | |
2016-04-13 15:20 | Stefan Teleman | Note Edited: 0040858 | bug_revision_view_page.php?bugnote_id=40858#r2070 |
2016-04-13 17:04 | Stefan Teleman | File Added: cmState.cxx-solaris-v2.patch | |
2016-04-13 17:05 | Stefan Teleman | Note Added: 0040861 | |
2016-04-15 13:26 | Brad King | Note Added: 0040867 | |
2016-04-15 13:26 | Brad King | Status | new => resolved |
2016-04-15 13:26 | Brad King | Resolution | open => fixed |
2016-04-15 13:26 | Brad King | Fixed in Version | => CMake 3.6 |
2016-04-15 13:26 | Brad King | Target Version | => CMake 3.6 |
2016-04-15 20:10 | Stefan Teleman | Note Added: 0040873 | |
2016-06-10 14:21 | Kitware Robot | Note Added: 0041191 | |
2016-06-10 14:21 | Kitware Robot | Status | resolved => closed |
Notes |
|
(0040851)
|
Brad King
|
2016-04-13 11:39
|
|
One should be able to read CMAKE_SYSTEM_NAME and CMAKE_HOST_SYSTEM_NAME to detect Solaris. The other names like "APPLE" pre-date those variables and are kept only for historical reasons. Therefore I do not think we should add new ones. |
|
|
(0040852)
|
Stefan Teleman
|
2016-04-13 14:08
|
|
My understanding is that CMAKE_SYSTEM_NAME and CMAKE_HOST_SYSTEM_NAME
are not set by cmake. These variables being set are the responsibility
of the project using cmake.
This is unreliable.
We would like to have a reliable, always-on mechanism for identifying
Solaris, regardless of whether or not a specific project has correctly
defined CMAKE_SYSTEM_NAME and/or CMAKE_HOST_SYSTEM_NAME. |
|
|
(0040853)
|
Stefan Teleman
|
2016-04-13 14:21
|
|
Not to mention the fact that sending <X> number of patches to an
unknown <Y> number of CMake-based projects that did not properly
define CMAKE_SYSTEM_NAME or CMAKE_HOST_SYSTEM_NAME does not scale
at all. |
|
|
(0040854)
|
Brad King
|
2016-04-13 14:24
|
|
|
|
(0040855)
|
Stefan Teleman
|
2016-04-13 14:58
|
|
%> ./cmake --version
cmake version 3.5.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
%> uname -a
SunOS xxxxxxx 5.12 s12_96 sun4v sparc sun4v Solaris
./cmake -P ./Solaris.cmake
--
-- SOLARIS is defined: 1
--
-- SUNOS is NOT defined
--
-- CMAKE_SYSTEM_NAME is NOT DEFINED!
--
-- CMAKE_HOST_SYSTEM_NAME is NOT DEFINED!
%> cat Solaris.cmake
function(solaris)
message (STATUS "")
IF (SOLARIS)
message (STATUS "SOLARIS is defined: ${SOLARIS}")
ELSE()
message (STATUS "SOLARIS is NOT defined")
ENDIF()
endfunction()
function(sunos)
message (STATUS "")
IF (SUNOS)
message (STATUS "SUNOS is defined: ${SUNOS}")
ELSE()
message (STATUS "SUNOS is NOT defined")
ENDIF()
endfunction()
function(cmake_system_name)
message (STATUS "")
IF (CMAKE_SYSTEM_NAME)
message (STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
ELSE()
message (STATUS "CMAKE_SYSTEM_NAME is NOT DEFINED!")
ENDIF()
endfunction()
function(cmake_host_system_name)
message (STATUS "")
IF (CMAKE_HOST_SYSTEM_NAME)
message (STATUS "CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
ELSE()
message (STATUS "CMAKE_HOST_SYSTEM_NAME is NOT DEFINED!")
ENDIF()
endfunction()
solaris()
sunos()
cmake_system_name()
cmake_host_system_name()
I do not see any of these variables being set by default by cmake.
SOLARIS is the only OS identifier variable being set, and that only
because of the patch I have provided earlier.
Also: in ${top_srcdir} for CMake 3.5.0:
%> find . -type f -name "*.cxx" -exec egrep -e 'CMAKE_HOST_SYSTEM_NAME' -n {} \; -print
%> find . -type f -name "*.h" -exec egrep -e 'CMAKE_HOST_SYSTEM_NAME' -n {} \; -print
%>
CMAKE_HOST_SYSTEM_NAME does not appear to be set by CMake anywhere in
the code. So, how can it be set by default by CMake, then? |
|
|
(0040856)
|
Brad King
|
2016-04-13 15:10
|
|
The variables are set by CMake in the context of a project with a CMakeLists.txt file. I didn't realize you're trying to do this for "cmake -P" mode before and forgot that it doesn't work for that.
Okay, I think we should add CMAKE_HOST_SOLARIS but not any name without a prefix.
Please run
$ git grep CMAKE_HOST_UNIX -- Help
to see where documentation for the new variable needs to be added and extend the patch to include it. |
|
|
(0040858)
|
Stefan Teleman
|
2016-04-13 15:18
(edited on: 2016-04-13 15:20) |
|
Okay, CMAKE_HOST_SOLARIS works great.
Stay tuned for an updated patch.
|
|
|
(0040861)
|
Stefan Teleman
|
2016-04-13 17:05
|
|
New patch - Version 2 - attached. |
|
|
(0040867)
|
Brad King
|
2016-04-15 13:26
|
|
|
|
(0040873)
|
Stefan Teleman
|
2016-04-15 20:10
|
|
|
|
(0041191)
|
Kitware Robot
|
2016-06-10 14:21
|
|
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. |
|