title: Adding global compile flags in CMake
body: <p>I am editing a CMakeLists.txt file made by someone else. I'm trying to get rid of some of the warnings generated when compiling the project.</p>
  
  <p>Normally I just add <code>set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_FLAGS}")</code> with whatever flags I need to add, and it works fine, but for this project, it's just not working. The warnings still appear. I tried a couple alternative methods, but nothing.</p>
  
  <p>What could be causing the issue?</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.1)
  project(PBS)
  
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
  
  option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
  option(LIBIGL_WITH_ANTTWEAKBAR       "Use AntTweakBar"    OFF)
  option(LIBIGL_WITH_CGAL              "Use CGAL"           OFF)
  option(LIBIGL_WITH_COMISO            "Use CoMiso"         OFF)
  option(LIBIGL_WITH_CORK              "Use Cork"           OFF)
  option(LIBIGL_WITH_EMBREE            "Use Embree"         OFF)
  option(LIBIGL_WITH_LIM               "Use LIM"            OFF)
  option(LIBIGL_WITH_MATLAB            "Use Matlab"         OFF)
  option(LIBIGL_WITH_MOSEK             "Use MOSEK"          OFF)
  option(LIBIGL_WITH_OPENGL            "Use OpenGL"         ON)
  option(LIBIGL_WITH_OPENGL_GLFW       "Use GLFW"           ON)
  option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui"          ON)
  option(LIBIGL_WITH_PNG               "Use PNG"            OFF)
  option(LIBIGL_WITH_PYTHON            "Use Python"         OFF)
  option(LIBIGL_WITH_TETGEN            "Use Tetgen"         OFF)
  option(LIBIGL_WITH_TRIANGLE          "Use Triangle"       OFF)
  option(LIBIGL_WITH_VIEWER            "Use OpenGL viewer"  ON)
  option(LIBIGL_WITH_XML               "Use XML"            OFF)
  
  if (NOT LIBIGL_FOUND)
      find_package(LIBIGL REQUIRED QUIET)
  endif()
  
  add_subdirectory(0_dummy)
  add_subdirectory(1_cannonball)
  add_subdirectory(2_spring)
  add_subdirectory(3_spinning)
  add_subdirectory(4_gyro)
  
  
  # Custom commands
  set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
  add_compile_options ( -Wno-reorder )
  add_definitions ( -Wno-unknown-pragmas )
  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I found out that adding the flags in one of the subdirectories works for that subdirectory (e.g. in <code>3_spinning/CMakeLists.txt</code>). Is there no way of setting the flags globally?</p>