diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 18133ff36fc..18a0c9b3797 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -910,7 +910,7 @@ install(PROGRAMS ${scripts} DESTINATION ${CGAL_INSTALL_BIN_DIR}) install(DIRECTORY ${CGAL_MODULES_REL_DIR}/ DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) install(FILES ${CGAL_MODULES_REL_DIR}/UseCGAL.cmake DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) -if ( GMP_IN_CGAL_AUXILIARY OR MPFR_IN_CGAL_AUXILIARY ) +if ( IS_DIRECTORY auxiliary/gmp/include AND IS_DIRECTORY auxiliary/gmp/lib ) install(DIRECTORY auxiliary/gmp/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} ) install(DIRECTORY auxiliary/gmp/lib/ DESTINATION ${CGAL_INSTALL_LIB_DIR} ) endif() diff --git a/Installation/cmake/modules/CGAL_SetupGMP.cmake b/Installation/cmake/modules/CGAL_SetupGMP.cmake index 082d926c0ee..1a8c28a3c13 100644 --- a/Installation/cmake/modules/CGAL_SetupGMP.cmake +++ b/Installation/cmake/modules/CGAL_SetupGMP.cmake @@ -56,14 +56,14 @@ function(use_CGAL_GMP_support target) return() endif() - if(NOT GMP_IN_CGAL_AUXILIARY) + if(NOT GMP_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include") target_include_directories(${target} SYSTEM ${keyword} ${GMP_INCLUDE_DIR}) else() target_include_directories(${target} SYSTEM ${keyword} $ $) endif() - if(NOT MPFR_IN_CGAL_AUXILIARY) + if(NOT MPFR_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include") target_include_directories(${target} SYSTEM ${keyword} ${MPFR_INCLUDE_DIR}) else() target_include_directories(${target} SYSTEM ${keyword} diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 2401063a25f..6f8e423af1d 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -14,11 +14,47 @@ if(PROPERTY_CGAL_run_at_the_end_of_configuration_INCLUDED) endif() function(CGAL_run_at_the_end_of_configuration variable access value current_list_file stack) - if(NOT access STREQUAL "MODIFIED_ACCESS" OR value) - # Only do something at the end of the CMake process, when the value of - # variable CMAKE_CURRENT_LIST_DIR is changed to the empty string. + if(NOT access STREQUAL "MODIFIED_ACCESS") return() endif() + if(CGAL_CHECK_UNUSED_CPP_FILES + AND NOT current_list_file STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" + AND stack STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") + file(GLOB _cppfiles ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) + get_property(_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) + if(_targets AND _cppfiles) + set(_sources) + foreach(_target ${_targets}) + get_property(_target_type TARGET ${_target} PROPERTY TYPE) + if(_target_type STREQUAL INTERFACE_LIBRARY) + continue() + endif() + get_property(_target_sources TARGET ${_target} PROPERTY SOURCES) + list(APPEND _sources ${_target_sources}) + endforeach() + if(_sources) + list(REMOVE_ITEM _cppfiles ${_sources}) + endif() + if(_cppfiles) + set(_warning "In ${CMAKE_CURRENT_SOURCE_DIR}, the following files are unused:") + foreach(_cppfile ${_cppfiles}) + set(_warning "${_warning} + ${_cppfile}") + endforeach() + set(_warning "${_warning} +") + message(AUTHOR_WARNING "${_warning}") + endif() + endif() + endif() + + if(value) + # Only do the following at the end of the CMake process, when the + # value of variable CMAKE_CURRENT_LIST_DIR is changed to the empty + # string. + return() + endif() + # Warn when CMAKE_BUILD_TYPE is empty or Debug if(DEFINED CMAKE_BUILD_TYPE AND ( NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") ) set(keyword WARNING) diff --git a/Installation/cmake/modules/FindGMP.cmake b/Installation/cmake/modules/FindGMP.cmake index f3084cc72f7..663203d11c9 100644 --- a/Installation/cmake/modules/FindGMP.cmake +++ b/Installation/cmake/modules/FindGMP.cmake @@ -4,7 +4,6 @@ # GMP_INCLUDE_DIR - the GMP include directory # GMP_LIBRARIES_DIR - directory where the GMP libraries are located # GMP_LIBRARIES - Link these to use GMP -# GMP_IN_CGAL_AUXILIARY - TRUE if the GMP found is the one distributed with CGAL in the auxiliary folder # TODO: support MacOSX @@ -52,8 +51,3 @@ if( NOT GMP_in_cache ) endif() find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR) - -if ( GMP_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" ) - cache_set( GMP_IN_CGAL_AUXILIARY TRUE ) -endif() - diff --git a/Installation/cmake/modules/FindMPFR.cmake b/Installation/cmake/modules/FindMPFR.cmake index cb3c0fc1c73..b21fb1f678e 100644 --- a/Installation/cmake/modules/FindMPFR.cmake +++ b/Installation/cmake/modules/FindMPFR.cmake @@ -3,7 +3,6 @@ # MPFR_INCLUDE_DIR - the MPFR include directory # MPFR_LIBRARIES_DIR - Directory where the MPFR libraries are located # MPFR_LIBRARIES - the MPFR libraries -# MPFR_IN_CGAL_AUXILIARY - TRUE if the MPFR found is the one distributed with CGAL in the auxiliary folder # TODO: support MacOSX @@ -51,7 +50,3 @@ if (NOT MPFR_in_cache) endif() find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES MPFR_INCLUDE_DIR) - -if ( MPFR_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" ) - cache_set( MPFR_IN_CGAL_AUXILIARY TRUE ) -endif() diff --git a/Installation/src/CGAL_libs_verinfo.rc.in b/Installation/src/CGAL_libs_verinfo.rc.in index d1f838e8db6..56a65021857 100644 --- a/Installation/src/CGAL_libs_verinfo.rc.in +++ b/Installation/src/CGAL_libs_verinfo.rc.in @@ -25,7 +25,7 @@ #define CGAL_VER_str(s) CGAL_VER_xstr(s) #define CGAL_VER_VERSION CGAL_VERSION_MAJOR,CGAL_VERSION_MINOR,CGAL_VERSION_PATCH,CGAL_VERSION_BUILD -#define CGAL_VER_VERSION_STR CGAL_VER_str(CGAL_VERSION) +#define CGAL_VER_VERSION_STR CGAL_VER_str(CGAL_VERSION_MAJOR) "." CGAL_VER_str(CGAL_VERSION_MINOR) "." CGAL_VER_str(CGAL_VERSION_PATCH) "." CGAL_VER_str(CGAL_VERSION_BUILD) #define CGAL_VER_COMPANYNAME_STR "The CGAL Project, https://www.cgal.org/\0" #define CGAL_VER_FILEDESCRIPTION_STR "@LIBRARY_NAME@ Library\0" #define CGAL_VER_FILEVERSION_STR CGAL_VER_VERSION_STR diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index 6dd0c4b41c3..c5d6f6c02db 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -79,10 +79,13 @@ if ( CGAL_FOUND ) endif() endif() - if(WIN32) + if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL Windows) + add_executable(display_dll_version_info display_dll_version_info.cpp) + target_link_libraries(display_dll_version_info version) add_executable(test_gmp_mpfr_dll test_gmp_mpfr_dll.cpp) - target_link_libraries(test_gmp_mpfr_dll Version) - endif(WIN32) + target_link_libraries(test_gmp_mpfr_dll version) + CGAL_add_test(test_gmp_mpfr_dll) + endif() find_package( LEDA QUIET) if(LEDA_FOUND) diff --git a/Installation/test/Installation/display_dll_version_info.cpp b/Installation/test/Installation/display_dll_version_info.cpp index 985e2ed15af..2ed4da4742c 100644 --- a/Installation/test/Installation/display_dll_version_info.cpp +++ b/Installation/test/Installation/display_dll_version_info.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) { } else { std::cerr << "Usage:\n" << " display_dll_version_info /path/to/a.dll\n"; - return 0; } + return 0; } #endif diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 9090f621866..84fd430f3f4 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -148,9 +148,10 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) qt5_add_resources ( CGAL_Qt5_RESOURCE_FILES Polyhedron_3.qrc ) find_path(CGAL_THREE_HEADERS_PATH - NAME CGAL/Three/Scene_item.h + NAMES CGAL/Three/Scene_item.h HINTS ${CGAL_INCLUDE_DIRS} NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH DOC "Path to CGAL/Three/Scene_item.h") if(CGAL_THREE_HEADERS_PATH) @@ -165,7 +166,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND ) qt5_generate_moc( "${CGAL_THREE_HEADERS_PATH}/CGAL/Three/TextRenderer.h" "${CMAKE_CURRENT_BINARY_DIR}/TextRenderer_moc.cpp" ) else() - message(FATAL_ERROR "Cannot find ") + message(FATAL_ERROR "Cannot find ") endif() unset(CGAL_THREE_HEADERS_PATH CACHE) diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 2396e370e89..a31df3910b0 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -815,7 +816,8 @@ private: static char * clean_pointer(char * p) { - return ((p - (char *) NULL) & ~ (std::ptrdiff_t) START_END) + (char *) NULL; + return reinterpret_cast(reinterpret_cast(p) & + ~ (std::ptrdiff_t) START_END); } // Returns the pointee, cleaned up from the squatted bits. @@ -828,7 +830,8 @@ private: static Type type(const_pointer ptr) { char * p = (char *) Traits::pointer(*ptr); - return (Type) (p - clean_pointer(p)); + return (Type) (reinterpret_cast(p) - + reinterpret_cast(clean_pointer(p))); } // Sets the pointer part and the type of the pointee. @@ -837,7 +840,8 @@ private: // This out of range compare is always true and causes lots of // unnecessary warnings. // CGAL_precondition(0 <= t && t < 4); - Traits::pointer(*ptr) = (void *) ((clean_pointer((char *) p)) + (int) t); + Traits::pointer(*ptr) = reinterpret_cast + (reinterpret_cast(clean_pointer((char *) p)) + (int) t); } public: diff --git a/STL_Extension/include/CGAL/Iterator_range.h b/STL_Extension/include/CGAL/Iterator_range.h index 1d906900968..39c79bd1d3f 100644 --- a/STL_Extension/include/CGAL/Iterator_range.h +++ b/STL_Extension/include/CGAL/Iterator_range.h @@ -77,6 +77,18 @@ namespace CGAL { { return begin()==end(); } +#ifndef CGAL_CFG_NO_CPP0X_TUPLE + + operator std::tuple() + { + return std::tuple{this->first, this->second}; + } + + operator std::tuple() const + { + return std::tuple{this->first, this->second}; + } +#endif };