diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index 02d2ba0a35..b68d167dac 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -177,6 +177,9 @@ function(wx_write_config) foreach(flag IN LISTS wxTOOLKIT_DEFINITIONS) wx_string_append(WXCONFIG_CPPFLAGS " -D${flag}") endforeach() + if(wxBUILD_LARGEFILE_SUPPORT) + wx_string_append(WXCONFIG_CPPFLAGS " -D_FILE_OFFSET_BITS=64") + endif() string(STRIP "${WXCONFIG_CPPFLAGS}" WXCONFIG_CPPFLAGS) set(WXCONFIG_CXXFLAGS ${WXCONFIG_CFLAGS}) set(WXCONFIG_LDFLAGS_GUI) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 8d43c56268..f927c9be7a 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -160,6 +160,19 @@ function(wx_set_common_target_properties target_name) ) endif() + if(wxUSE_NO_RTTI) + if(MSVC) + target_compile_options(${target_name} PRIVATE "/GR-") + elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) + target_compile_options(${target_name} PRIVATE "-fno-rtti") + endif() + target_compile_definitions(${target_name} PRIVATE "-DwxNO_RTTI") + endif() + + if(wxBUILD_LARGEFILE_SUPPORT) + target_compile_definitions(${target_name} PUBLIC "-D_FILE_OFFSET_BITS=64") + endif() + if(CMAKE_USE_PTHREADS_INIT) target_compile_options(${target_name} PRIVATE "-pthread") # clang++.exe: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument] diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index d1f035953f..796867d23d 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -101,15 +101,6 @@ if(NOT wxBUILD_COMPATIBILITY STREQUAL "NONE") endif() endif() -if(wxUSE_NO_RTTI) - if(MSVC) - add_compile_options("/GR-") - elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) - wx_string_append(CMAKE_CXX_FLAGS " -fno-rtti") - endif() - add_definitions("-DwxNO_RTTI") -endif() - # Build wxBUILD_FILE_ID used for config and setup path #TODO: build different id for WIN32 set(wxBUILD_FILE_ID "${wxBUILD_TOOLKIT}${wxBUILD_WIDGETSET}-") @@ -341,6 +332,10 @@ if(UNIX) wx_option_force_value(wxUSE_LIBICONV OFF) endif() endif() + + if(wxBUILD_LARGEFILE_SUPPORT) + set(HAVE_LARGEFILE_SUPPORT ON) + endif() endif(UNIX) if(wxUSE_GUI) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 2c70d91763..96f3c504c4 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -56,6 +56,11 @@ if(NOT MSVC OR MSVC_VERSION GREATER 1800) ${wxCXX_STANDARD_DEFAULT} STRINGS COMPILER_DEFAULT 11 14 17 20) endif() +if(UNIX) + wx_option(wxBUILD_LARGEFILE_SUPPORT "support for large files") + mark_as_advanced(wxBUILD_LARGEFILE_SUPPORT) +endif() + if(WIN32) set(wxBUILD_VENDOR "custom" CACHE STRING "Short string identifying your company (used in DLL name)") endif() diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 8e3ec91d94..75d7f0c341 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -45,6 +45,7 @@ endif() if(UNIX) wx_setup_definition(wxUSE_UNIX) wx_setup_definition(__UNIX__) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_FILE_OFFSET_BITS=64) endif() if(UNIX AND NOT APPLE) @@ -346,6 +347,10 @@ if(UNIX) wx_check_funcs(fdopen) + if(wxBUILD_LARGEFILE_SUPPORT) + wx_check_funcs(fseeko) + endif() + if(wxUSE_TARSTREAM) wx_check_funcs(sysconf) diff --git a/docs/doxygen/overviews/cmake.md b/docs/doxygen/overviews/cmake.md index b7427433f9..dc887fd059 100644 --- a/docs/doxygen/overviews/cmake.md +++ b/docs/doxygen/overviews/cmake.md @@ -114,7 +114,9 @@ Your *CMakeLists.txt* would look like this: ... find_package(wxWidgets REQUIRED COMPONENTS net core base) -include(${wxWidgets_USE_FILE}) +if(wxWidgets_USE_FILE) # not defined in CONFIG mode + include(${wxWidgets_USE_FILE}) +endif() add_executable(myapp myapp.cpp) target_link_libraries(myapp ${wxWidgets_LIBRARIES}) ~~~