Quantcast

Changing /W3 to /W4 does not update CMakeCache.txt

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Changing /W3 to /W4 does not update CMakeCache.txt

Andrew Maclean-3
Consider the attached CMakeLists.txt script.

When run, CMAKE_CXX_FLAGS is updated correctly, however the line:
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
in CMakeCache.txt is never updated. 

However the build instructions e.g build.ninja reflect the correct command:
 FLAGS = /DWIN32 /D_WINDOWS /W4 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Similarly for the Visual Studio Build.

I see this behaviour in my own code and also in VTK.

Is there a reason why CMakeCache.txt does not get the update?

Andrew


--
___________________________________________
Andrew J. P. Maclean

___________________________________________

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

CMakeLists.txt (1K) Download Attachment
main.cxx (90 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing /W3 to /W4 does not update CMakeCache.txt

Craig Scott-3
Your CMakeLists.txt file is modifying the non-cache variable CMAKE_CXX_FLAGS. During CMake processing, a non-cache variable will override a cache variable of the same name, but modifying a non-cache variable won't update the cache. CMake is working as designed with regard to the handling of CMAKE_CXX_FLAGS here, your expectation of the cache being updated to reflect your changes to the non-cache variable is the source of the confusion. Please review the following link which describes this in more detail:



On Fri, Feb 3, 2017 at 10:01 AM, Andrew Maclean <[hidden email]> wrote:
Consider the attached CMakeLists.txt script.

When run, CMAKE_CXX_FLAGS is updated correctly, however the line:
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
in CMakeCache.txt is never updated. 

However the build instructions e.g build.ninja reflect the correct command:
 FLAGS = /DWIN32 /D_WINDOWS /W4 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Similarly for the Visual Studio Build.

I see this behaviour in my own code and also in VTK.

Is there a reason why CMakeCache.txt does not get the update?

Andrew


--
___________________________________________
Andrew J. P. Maclean

___________________________________________

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Craig Scott
Melbourne, Australia

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing /W3 to /W4 does not update CMakeCache.txt

Andrew Maclean-3
Craig,
   Thanks for this, I had forgotten the distinction between non-cached variables and cached variables

I guess the issue is that whilst it is possible to modify the cached entry, it will never be used since the non-cached variable will always override it whenever cmake is invoked.

Andrew

On Fri, Feb 3, 2017 at 10:26 AM, Craig Scott <[hidden email]> wrote:
Your CMakeLists.txt file is modifying the non-cache variable CMAKE_CXX_FLAGS. During CMake processing, a non-cache variable will override a cache variable of the same name, but modifying a non-cache variable won't update the cache. CMake is working as designed with regard to the handling of CMAKE_CXX_FLAGS here, your expectation of the cache being updated to reflect your changes to the non-cache variable is the source of the confusion. Please review the following link which describes this in more detail:



On Fri, Feb 3, 2017 at 10:01 AM, Andrew Maclean <[hidden email]> wrote:
Consider the attached CMakeLists.txt script.

When run, CMAKE_CXX_FLAGS is updated correctly, however the line:
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
in CMakeCache.txt is never updated. 

However the build instructions e.g build.ninja reflect the correct command:
 FLAGS = /DWIN32 /D_WINDOWS /W4 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Similarly for the Visual Studio Build.

I see this behaviour in my own code and also in VTK.

Is there a reason why CMakeCache.txt does not get the update?

Andrew


--
___________________________________________
Andrew J. P. Maclean

___________________________________________

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Craig Scott
Melbourne, Australia



--
___________________________________________
Andrew J. P. Maclean

___________________________________________

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing /W3 to /W4 does not update CMakeCache.txt

Craig Scott-3
See the first item on the following article for guidance on how to combine cache and non-cache values for CMAKE_CXX_FLAGS:



On Fri, Feb 3, 2017 at 12:19 PM, Andrew Maclean <[hidden email]> wrote:
Craig,
   Thanks for this, I had forgotten the distinction between non-cached variables and cached variables

I guess the issue is that whilst it is possible to modify the cached entry, it will never be used since the non-cached variable will always override it whenever cmake is invoked.

Andrew

On Fri, Feb 3, 2017 at 10:26 AM, Craig Scott <[hidden email]> wrote:
Your CMakeLists.txt file is modifying the non-cache variable CMAKE_CXX_FLAGS. During CMake processing, a non-cache variable will override a cache variable of the same name, but modifying a non-cache variable won't update the cache. CMake is working as designed with regard to the handling of CMAKE_CXX_FLAGS here, your expectation of the cache being updated to reflect your changes to the non-cache variable is the source of the confusion. Please review the following link which describes this in more detail:



On Fri, Feb 3, 2017 at 10:01 AM, Andrew Maclean <[hidden email]> wrote:
Consider the attached CMakeLists.txt script.

When run, CMAKE_CXX_FLAGS is updated correctly, however the line:
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
in CMakeCache.txt is never updated. 

However the build instructions e.g build.ninja reflect the correct command:
 FLAGS = /DWIN32 /D_WINDOWS /W4 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Similarly for the Visual Studio Build.

I see this behaviour in my own code and also in VTK.

Is there a reason why CMakeCache.txt does not get the update?

Andrew


--
___________________________________________
Andrew J. P. Maclean

___________________________________________

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Craig Scott
Melbourne, Australia



--
___________________________________________
Andrew J. P. Maclean

___________________________________________



--
Craig Scott
Melbourne, Australia

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...