build: gh672 Fix CMake CXX_FLAGS inheritance
authorKarl Schultz <karl@lunarg.com>
Fri, 2 Sep 2016 16:17:05 +0000 (10:17 -0600)
committerKarl Schultz <karl@lunarg.com>
Fri, 2 Sep 2016 16:17:05 +0000 (10:17 -0600)
Some sub-projects were overwriting CMAKE_CXX_FLAGS instead of
inheriting from the parent.  This keeps any user settings outside
or above the top CMakeLists.txt file from reaching these sub-projects.

These fixes include preserving the inheritance, adding extra flags
to turn off warnings (mostly in autogen code) because the top
level turns on Wall, and trivial code fixes to avoid the need to
add a setting to turn off a warning for those trivial fixes.

These changes should have no impact on Windows.

Change-Id: I0c3c175cb5058f26a259ee3f4fde9fdaf3e6b00d

layers/CMakeLists.txt
layers/parameter_validation.cpp
libs/vkjson/CMakeLists.txt
tests/layers/CMakeLists.txt
tests/layers/wrap_objects.cpp

index 9d6705b..9a9b4d4 100644 (file)
@@ -98,9 +98,8 @@ if (WIN32)
     set (CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
     set (CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
 else()
-    set (CMAKE_CXX_FLAGS "-std=c++11")
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith")
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith")
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
 endif()
 
 add_custom_command(OUTPUT vk_dispatch_table_helper.h
index 376bc77..bf45285 100644 (file)
@@ -4951,6 +4951,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhy
         result = get_dispatch_table(pc_instance_table_map, physicalDevice)
                      ->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID);
     }
+    return result;
 }
 #endif // VK_USE_PLATFORM_XLIB_KHR
 
index fc69bb6..16b8e21 100644 (file)
@@ -19,9 +19,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
-if (NOT WIN32)
-    set (CMAKE_CXX_FLAGS "-std=c++11")
-endif()
 include_directories(
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/../../loader
@@ -31,6 +28,7 @@ include_directories(
 add_library(vkjson STATIC vkjson.cc vkjson_instance.cc ../../loader/cJSON.c)
 
 if(UNIX)
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
     add_executable(vkjson_unittest vkjson_unittest.cc)
     add_executable(vkjson_info vkjson_info.cc)
 else()
index 3622f6a..21a287b 100644 (file)
@@ -68,9 +68,8 @@ if (WIN32)
     set (CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
     set (CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
 else()
-    set (CMAKE_CXX_FLAGS "-std=c++11")
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith")
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith")
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function")
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function")
 endif()
 
 add_custom_command(OUTPUT vk_dispatch_table_helper.h
index 9f7867c..f0de3c4 100644 (file)
@@ -1505,7 +1505,7 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(V
         return addr;
 
     wrapped_inst_obj *inst;
-    auto vk_inst = unwrap_instance(instance, &inst);
+    (void)unwrap_instance(instance, &inst);
     VkLayerInstanceDispatchTable* pTable = &inst->layer_disp;
 
     // EXT_debug_report