Merge topic 'hpux-compile'

be53734d CompileFlags: Add -AA +hpxstd98 on HP-UX 11.11 with aCC
f4b9c6bb CompileFlags: Test for C++ features after selecting flags
This commit is contained in:
Brad King 2014-04-04 13:33:37 -04:00 committed by CMake Topic Stage
commit a02c30c294
2 changed files with 34 additions and 2 deletions

View File

@ -19,7 +19,6 @@ endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
endif()
include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
set(_INTEL_WINDOWS 1)
@ -54,6 +53,14 @@ if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX" AND CMAKE_CXX_COMPILER_ID MATCHES "HP")
# it is known that version 3.85 fails and 6.25 works without these flags
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4)
# use new C++ library and improved template support
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98")
endif()
endif()
# use the ansi CXX compile flag for building cmake
if (CMAKE_ANSI_CXXFLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
@ -68,3 +75,5 @@ endif ()
if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text._*")
endif ()
include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)

View File

@ -1086,8 +1086,8 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
cmake_test_flags=
# If we are on HP-UX, check for -Ae for the C compiler.
cmake_test_flags="-Ae"
if [ "x${cmake_system}" = "xHP-UX" ]; then
cmake_test_flags="-Ae"
TMPFILE=`cmake_tmp_file`
echo '
int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
@ -1108,6 +1108,29 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
fi
rm -f "${TMPFILE}.c"
echo '
#include <iostream>
int main(int argc, char** argv) {
for(int i=0; i < 1; ++i);
for(int i=0; i < 1; ++i);
(void)argc; (void)argv; return 0; }
' > ${TMPFILE}.cxx
cmake_need_AAstd98=0
cmake_test_flags="-AA +hpxstd98"
if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
:
else
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
cmake_need_AAstd98=1
fi
fi
if [ "x${cmake_need_AAstd98}" = "x1" ]; then
cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
else
echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
fi
fi
cmake_test_flags=
fi