diff --git a/CMakeLists.txt b/CMakeLists.txt index feef2e1a678..769ace7efd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ set(CMAKE_LINK_DEPENDS_NO_SHARED 1) # Do not relink all depended targets on .so set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel" CACHE STRING "" FORCE) set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.") # To be consistent with CMakeLists from contrib libs. +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + option(ENABLE_IPO "Enable inter-procedural optimization (aka LTO)" OFF) # need cmake 3.9+ if(ENABLE_IPO) cmake_policy(SET CMP0069 NEW) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 1d438e29dae..c9888407a6d 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,5 +1,13 @@ # Third-party libraries may have substandard code. +get_filename_component (_current_dir_name "${CMAKE_CURRENT_LIST_DIR}" NAME) +if (CMAKE_FOLDER) + set (CMAKE_FOLDER "${CMAKE_FOLDER}/${_current_dir_name}") +else () + set (CMAKE_FOLDER "${_current_dir_name}") +endif () +unset (_current_dir_name) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")