Skip to content
Browse files

Merge topic 'cleanup-cmake-compatibility' into master

8b39b35 Remove CMakeBackwardCompatibilityC altogether
3b0a4a8 Remove old CMakeBackwardCompatibilityC CMAKE_X_* options
fe401e0 Remove old CMakeBackwardCompatibilityC thread options
b407455 Remove top-level include file compatibility checks
e56a7eb Drop workaround for no std:: namespace
ff74963 Drop workaround for non-ANSI 'for' scope
1779dd9 Rename {CMAKE => VTK}_SIZEOF_* for fundamental types
3330807 Teach vtktiff to use its own SIZEOF_(INT|LONG) test results
  • Loading branch information...
2 parents fcf4375 + 8b39b35 commit f64b4c25b9d58f6ab078c048fb4767ba0aacce68 @bradking bradking committed with Code Review Mar 6, 2012
View
90 CMake/CMakeBackwardCompatibilityC.cmake
@@ -1,90 +0,0 @@
-# Nothing here yet
-IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
- INCLUDE(CMakeVS7BackwardCompatibility)
- SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
-ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
-IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
- INCLUDE(CMakeVS6BackwardCompatibility)
- SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
-ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
-
-IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
- INCLUDE (CheckTypeSize)
- CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
- CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
- CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
- CHECK_TYPE_SIZE(char CMAKE_SIZEOF_CHAR)
- CHECK_TYPE_SIZE(short CMAKE_SIZEOF_SHORT)
- CHECK_TYPE_SIZE(float CMAKE_SIZEOF_FLOAT)
- CHECK_TYPE_SIZE(double CMAKE_SIZEOF_DOUBLE)
-
- INCLUDE (CheckIncludeFiles)
- CHECK_INCLUDE_FILES("limits.h" CMAKE_HAVE_LIMITS_H)
- CHECK_INCLUDE_FILES("unistd.h" CMAKE_HAVE_UNISTD_H)
- CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
- CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H)
- # include the following file to keep stuff which relies on the fact that it
- # is included here, keeps working
- INCLUDE (CheckIncludeFile)
-
- INCLUDE (TestBigEndian)
- TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
-
- IF(NOT VTK_DONT_INCLUDE_USE_X)
- IF(NOT APPLE OR VTK_USE_X)
- INCLUDE (FindX11)
- ENDIF(NOT APPLE OR VTK_USE_X)
- ENDIF(NOT VTK_DONT_INCLUDE_USE_X)
-
- IF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
- SET (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
- ELSE("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
- SET (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
- "X11 extra flags.")
- ENDIF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
- SET (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
- "Libraries and options used in X11 programs.")
- SET (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
-
- INCLUDE (FindThreads)
-
- SET (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
- "Thread library used.")
-
- SET (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
- "Use the pthreads library.")
-
- SET (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
- "Use the win32 thread library.")
-
- SET (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
- "Use HP pthreads.")
-
- SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
- "Use sproc libs.")
-
- IF(MINGW AND CMAKE_USE_PTHREADS AND CMAKE_USE_WIN32_THREADS)
- MESSAGE(STATUS
- "Forcing CMAKE_USE_PTHREADS OFF as only one threading library should be used.")
- SET(CMAKE_USE_PTHREADS OFF CACHE BOOL
- "Force pthreads off if WIN32 threads are enabled" FORCE)
- SET(CMAKE_THREAD_LIBS "" CACHE STRING "Thread library used." FORCE)
- ELSE()
- SET(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
- ENDIF()
-ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
-
-SET (VTK_MAX_THREADS "64" CACHE STRING
- "Max number of threads vktMultiThreader will allocate.")
-
-MARK_AS_ADVANCED(
-CMAKE_HP_PTHREADS
-CMAKE_THREAD_LIBS
-CMAKE_USE_PTHREADS
-CMAKE_USE_SPROC
-CMAKE_USE_WIN32_THREADS
-CMAKE_X_CFLAGS
-CMAKE_X_LIBS
-VTK_MAX_THREADS
-)
-
View
14 CMake/vtkTestTypes.cmake
@@ -1,11 +1,13 @@
-SET(VTK_SIZEOF_CHAR ${CMAKE_SIZEOF_CHAR})
-SET(VTK_SIZEOF_DOUBLE ${CMAKE_SIZEOF_DOUBLE})
-SET(VTK_SIZEOF_FLOAT ${CMAKE_SIZEOF_FLOAT})
-SET(VTK_SIZEOF_INT ${CMAKE_SIZEOF_INT})
-SET(VTK_SIZEOF_LONG ${CMAKE_SIZEOF_LONG})
-SET(VTK_SIZEOF_SHORT ${CMAKE_SIZEOF_SHORT})
SET(VTK_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
+INCLUDE (CheckTypeSize)
+CHECK_TYPE_SIZE(int VTK_SIZEOF_INT)
+CHECK_TYPE_SIZE(long VTK_SIZEOF_LONG)
+CHECK_TYPE_SIZE(char VTK_SIZEOF_CHAR)
+CHECK_TYPE_SIZE(short VTK_SIZEOF_SHORT)
+CHECK_TYPE_SIZE(float VTK_SIZEOF_FLOAT)
+CHECK_TYPE_SIZE(double VTK_SIZEOF_DOUBLE)
+
CHECK_TYPE_SIZE("long long" VTK_SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("__int64" VTK_SIZEOF___INT64)
CHECK_TYPE_SIZE("uintptr_t" VTK_UINTPTR_T)
View
36 CMakeLists.txt
@@ -514,11 +514,33 @@ ADD_DEFINITIONS(-DVTK_IN_VTK)
#-----------------------------------------------------------------------------
# Platform configuration tests.
-INCLUDE(CMakeBackwardCompatibilityC)
+
+INCLUDE (TestBigEndian)
+TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
+
+include(FindThreads)
+set(VTK_USE_WIN32_THREADS 0)
+set(VTK_USE_PTHREADS 0)
+set(VTK_HP_PTHREADS 0)
+set(VTK_USE_SPROC 0)
+if(CMAKE_USE_WIN32_THREADS_INIT)
+ set(VTK_USE_WIN32_THREADS 1)
+ set(CMAKE_THREAD_LIBS_INIT "")
+elseif(CMAKE_USE_PTHREADS_INIT)
+ set(VTK_USE_PTHREADS 1)
+ if(CMAKE_HP_PTHREADS_INIT)
+ set(VTK_HP_PTHREADS 1)
+ endif()
+elseif(CMAKE_USE_SPROC_INIT)
+ set(VTK_USE_SPROC 1)
+endif()
+set(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
+mark_as_advanced(CMAKE_THREAD_LIBS)
+set(VTK_MAX_THREADS "64" CACHE STRING
+ "Max number of threads vktMultiThreader will allocate.")
+mark_as_advanced(VTK_MAX_THREADS)
+
INCLUDE(TestForANSIStreamHeaders)
-INCLUDE(TestForSTDNamespace)
-INCLUDE(TestForANSIForScope)
-INCLUDE(CheckTypeSize)
# Simulate old CMakeBackwardCompatibilityCXX test.
INCLUDE(TestForSSTREAM)
@@ -548,13 +570,7 @@ MACRO(VTK_PREPARE_CMAKEDEFINE not invar outvar)
ENDMACRO(VTK_PREPARE_CMAKEDEFINE)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_WORDS_BIGENDIAN VTK_WORDS_BIGENDIAN)
-VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_PTHREADS VTK_USE_PTHREADS)
-VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_SPROC VTK_USE_SPROC)
-VTK_PREPARE_CMAKEDEFINE("" CMAKE_HP_PTHREADS VTK_HP_PTHREADS)
-VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_WIN32_THREADS VTK_USE_WIN32_THREADS)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_NO_ANSI_STRING_STREAM VTK_NO_ANSI_STRING_STREAM)
-VTK_PREPARE_CMAKEDEFINE("" CMAKE_NO_STD_NAMESPACE VTK_NO_STD_NAMESPACE)
-VTK_PREPARE_CMAKEDEFINE(NOT CMAKE_ANSI_FOR_SCOPE VTK_NO_FOR_SCOPE)
VTK_PREPARE_CMAKEDEFINE(NOT VTK_EXPLICIT_TEMPLATES
VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
VTK_PREPARE_CMAKEDEFINE(NOT VTK_COMPILER_HAS_FULL_SPECIALIZATION
View
6 IO/CMakeLists.txt
@@ -400,11 +400,11 @@ IF ( VTK_USE_ODBC AND ODBC_FOUND )
# ODBC code with -DBUILD_REAL_64_BIT_MODE in order to have the driver
# work properly.
INCLUDE(CheckTypeSize)
- CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_LONG)
- IF ( "${CMAKE_SIZEOF_LONG}" STREQUAL "8" )
+ CHECK_TYPE_SIZE("unsigned long" VTK_SIZEOF_LONG)
+ IF("${VTK_SIZEOF_LONG}" STREQUAL "8")
# MESSAGE( STATUS "Building ODBC driver with 64-bit flag." )
ADD_DEFINITIONS( -DBUILD_REAL_64_BIT_MODE )
- ENDIF ( "${CMAKE_SIZEOF_LONG}" STREQUAL "8" )
+ ENDIF()
ENDIF ( VTK_USE_ODBC AND ODBC_FOUND )
#-----------------------------------------------------------------------------
View
5 Rendering/CMakeLists.txt
@@ -765,8 +765,9 @@ IF (TK_FOUND AND VTK_USE_TK)
ENDIF (TK_FOUND AND VTK_USE_TK)
IF(VTK_GENERATE_TK_INTERNALS)
- SET (HAVE_LIMITS_H ${CMAKE_HAVE_LIMITS_H})
- SET (HAVE_UNISTD_H ${CMAKE_HAVE_UNISTD_H})
+ INCLUDE (CheckIncludeFiles)
+ CHECK_INCLUDE_FILES("limits.h" HAVE_LIMITS_H)
+ CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/vtkTkInternals.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkTkInternals.h)
View
4 Utilities/DICOMParser/CMakeLists.txt
@@ -19,10 +19,6 @@ ELSE(VTK_SOURCE_DIR)
SET(DICOM_ANSI_STDLIB 1)
ENDIF(VTK_SOURCE_DIR)
-INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
-SET(DICOM_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})
-
-
CONFIGURE_FILE(${DICOMParser_SOURCE_DIR}/DICOMCMakeConfig.h.in
${DICOMParser_BINARY_DIR}/DICOMCMakeConfig.h)
View
1 Utilities/DICOMParser/DICOMCMakeConfig.h.in
@@ -5,7 +5,6 @@
#cmakedefine DICOM_DLL
#cmakedefine DICOM_STATIC
#cmakedefine DICOM_ANSI_STDLIB
-#cmakedefine DICOM_NO_STD_NAMESPACE
#include <vtksys/Configure.hxx>
View
6 Utilities/DICOMParser/DICOMConfig.h
@@ -33,11 +33,7 @@
//
// END toolkit (ITK, VTK, etc) specific
//
-#ifdef DICOM_NO_STD_NAMESPACE
- #define dicom_stl
-#else
- #define dicom_stl std
-#endif
+#define dicom_stl std
#ifdef DICOM_ANSI_STDLIB
#define dicom_stream std
View
2 Utilities/ftgl/CMakeLists.txt
@@ -218,7 +218,7 @@ IF (FTGL_BUILD_EXAMPLES)
IF (XMU_LIBRARY)
SET (VTKFTGL_EXAMPLES_LIBS "${VTKFTGL_EXAMPLES_LIBS};${XMU_LIBRARY}")
ENDIF (XMU_LIBRARY)
- SET (VTKFTGL_EXAMPLES_LIBS "${VTKFTGL_EXAMPLES_LIBS};${CMAKE_X_LIBS}")
+ SET (VTKFTGL_EXAMPLES_LIBS "${VTKFTGL_EXAMPLES_LIBS};${X11_LIBRARIES}")
ENDIF (VTK_USE_X)
#
View
6 Utilities/vtkfreetype/builds/unix/ftconfig.h.in
@@ -83,9 +83,9 @@ FT_BEGIN_HEADER
#define FT_CHAR_BIT CHAR_BIT
#endif
-/* VTK_FREETYPE_CHANGE use cmake's sizes instead of the big test */
-#define FT_SIZEOF_INT ${CMAKE_SIZEOF_INT}
-#define FT_SIZEOF_LONG ${CMAKE_SIZEOF_LONG}
+/* VTK_FREETYPE_CHANGE use VTK's sizes instead of the big test */
+#define FT_SIZEOF_INT ${VTK_SIZEOF_INT}
+#define FT_SIZEOF_LONG ${VTK_SIZEOF_LONG}
/* FT_UNUSED is a macro used to indicate that a given parameter is not */
View
5 Utilities/vtklibproj4/CMakeLists.txt
@@ -32,10 +32,9 @@ endif ( PROJ_LIST_EXTERNAL AND BUILD_SHARED_LIBS )
option( PROJ_USE_PTHREADS "Should libproj4 be built as a thread-friendly library?" OFF )
mark_as_advanced( PROJ_USE_PTHREADS )
if ( PROJ_USE_PTHREADS )
- include( ${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake )
- if ( NOT CMAKE_USE_PTHREADS )
+ if ( NOT VTK_USE_PTHREADS )
message( FATAL "Your platform does not appear to support pthreads. Please turn PROJ_USE_PTHREADS off and retry." )
- endif ( NOT CMAKE_USE_PTHREADS )
+ endif ( NOT VTK_USE_PTHREADS )
endif ( PROJ_USE_PTHREADS )
# Include code that requires GSL
View
13 Utilities/vtklibxml2/CMakeLists.txt
@@ -25,15 +25,6 @@ SET(LIBXML2_PLATFORM_TEST_FILE_C platformTestsC.c)
set(CMAKE_THREAD_PREFER_PTHREAD OFF)
FIND_PACKAGE(Threads)
-IF(MINGW AND CMAKE_USE_PTHREADS AND CMAKE_USE_WIN32_THREADS)
- MESSAGE(STATUS
- "Forcing CMAKE_USE_PTHREADS OFF as only one threading library should be used.")
- SET(CMAKE_USE_PTHREADS OFF CACHE BOOL
- "Force pthreads off if WIN32 threads are enabled" FORCE)
- SET(CMAKE_THREAD_LIBS "" CACHE STRING "Force pthreads off if WIN32 threads are enabled" FORCE)
-ELSE()
- SET(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
-ENDIF()
# This macro checks if the symbol exists in the library and if it
# does, it appends library to the list.
@@ -215,9 +206,9 @@ ELSE(HAVE_ZLIB_H AND HAVE_LIBZ)
ENDIF(HAVE_ZLIB_H AND HAVE_LIBZ)
# not building VTK with pthreads
-IF(NOT CMAKE_USE_PTHREADS AND HAVE_PTHREAD_H)
+IF(NOT VTK_USE_PTHREADS AND HAVE_PTHREAD_H)
SET(HAVE_PTHREAD_H 0)
-ENDIF(NOT CMAKE_USE_PTHREADS AND HAVE_PTHREAD_H)
+ENDIF()
# Create the platform configuration header.
CONFIGURE_FILE(${vtklibxml2_SOURCE_DIR}/config_cmake.h.in
View
8 Utilities/vtksqlite/CMakeLists.txt
@@ -32,13 +32,13 @@ IF (WIN32)
ELSE (WIN32)
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES("pthread.h" HAVE_PTHREAD_H)
- IF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
+ IF(HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
ADD_DEFINITIONS(-DHAVE_PTHREAD_H)
- ENDIF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
+ ENDIF()
VTK_ADD_LIBRARY( vtksqlite ${SQLite_SRCS} )
- IF (UNIX AND HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
+ IF (UNIX AND HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
TARGET_LINK_LIBRARIES(vtksqlite ${CMAKE_THREAD_LIBS})
- ENDIF (UNIX AND HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
+ ENDIF()
ENDIF (WIN32)
IF(VTK_LIBRARY_PROPERTIES)
View
4 Utilities/vtktiff/tif_config.h.in
@@ -189,7 +189,7 @@
#cmakedefine PTHREAD_CREATE_JOINABLE
/* The size of a `int', as computed by sizeof. */
-#define SIZEOF_INT @CMAKE_SIZEOF_INT@
+#define SIZEOF_INT @SIZEOF_INT@
/* On Apple, universal builds use different settings on each build.
the sizes can be different.*/
@@ -201,7 +201,7 @@ the sizes can be different.*/
# endif
#else
/* The size of a `long', as computed by sizeof. */
-# define SIZEOF_LONG @CMAKE_SIZEOF_LONG@
+# define SIZEOF_LONG @SIZEOF_LONG@
#endif
/* Define to 1 if you have the ANSI C header files. */
View
4 Wrapping/Python/CMakeLists.txt
@@ -283,8 +283,8 @@ IF(VTK_WRAP_TCL)
TARGET_LINK_LIBRARIES(vtkpython ${VTK_TK_LIBRARIES})
ENDIF(VTK_WRAP_TCL)
-IF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
- TARGET_LINK_LIBRARIES(vtkpython ${CMAKE_THREAD_LIBS_INIT})
+IF(HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
+ TARGET_LINK_LIBRARIES(vtkpython ${CMAKE_THREAD_LIBS})
ENDIF()
IF(VTK_USE_FFMPEG_ENCODER)
View
24 vtkConfigure.h.in
@@ -96,8 +96,6 @@
#cmakedefine VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION
#cmakedefine VTK_NO_FULL_TEMPLATE_SPECIALIZATION
#cmakedefine VTK_NO_ANSI_STRING_STREAM
-#cmakedefine VTK_NO_STD_NAMESPACE
-#cmakedefine VTK_NO_FOR_SCOPE
#cmakedefine VTK_COMPILER_HAS_BOOL
#cmakedefine VTK_ISTREAM_SUPPORTS_LONG_LONG
#cmakedefine VTK_OSTREAM_SUPPORTS_LONG_LONG
@@ -178,11 +176,7 @@
/* Setup vtkstd, a portable namespace for std. */
#ifndef VTK_LEGACY_REMOVE
-# ifndef VTK_NO_STD_NAMESPACE
-# define vtkstd std
-# else
-# define vtkstd
-# endif
+# define vtkstd std
#endif
/* Define a "vtkstd_bool" type. This should be used as the
@@ -208,22 +202,6 @@
# endif
#endif
-#cmakedefine VTK_USE_FOR_SCOPE_WORKAROUND
-
-/* Use the common for-scope work-around when compiling a source in VTK. */
-/* External Projects can set VTK_USE_FOR_SCOPE_WORKAROUND to get this "fix" */
-#if (defined(VTK_IN_VTK) && !defined(VTK_NO_WORKAROUND_FOR_SCOPE)) || defined(VTK_USE_FOR_SCOPE_WORKAROUND)
-# define VTK_WORKAROUND_FOR_SCOPE
-#endif
-#if defined(VTK_NO_FOR_SCOPE) && defined(VTK_WORKAROUND_FOR_SCOPE)
-# ifndef for
-# define for if(0) {} else for
-# if defined(_MSC_VER)
-# pragma warning (disable: 4127) /* conditional expression is constant */
-# endif
-# endif
-#endif
-
/* Provide missing streaming operators. */
#if defined(VTK_SIZEOF_LONG_LONG)
# if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)

0 comments on commit f64b4c2

Please sign in to comment.
Something went wrong with that request. Please try again.