Thank you, it worked.
On 2011-10-13 16:35, David Cole wrote:
As this grep from a Visual Studio build tree shows, the variables
containing "/O" compiler flags are the configuration-specific
variables:
$ grep "/O" CMakeCache.txt
CMAKE_CXX_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /D NDEBUG
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /D NDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /D NDEBUG
CMAKE_C_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
CMAKE_C_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /D NDEBUG
CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /D NDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /D NDEBUG
Rather than setting CMAKE_CXX_FLAGS and CMAKE_C_FLAGS as you tried,
use string REPLACE instead to get rid of the specific /O args that
you're trying to replace:
string(REPLACE "/O2" "/Ox" CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE}")
Repeat as necessary with other variables and other /O values...
2011/10/13 Radio młodych bandytów<radiomlodychbandy...@o2.pl>:
I have code like below:
IF(MSVC)
set(CMAKE_CXX_FLAGS /Ox)
set(CMAKE_C_FLAGS /Ox)
ENDIF(MSVC)
However, the flag is ignored and CMake generates projects that use /O2.
How can I fix it?
--
Twoje radio
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
--
Twoje radio
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake