[CMake] Testing for SSE and adding appropriate Compile options
Michael Jackson
mike.jackson at bluequartz.net
Fri Sep 25 13:57:26 EDT 2009
I am testing for SSE2/SSE3 functionality and am having some issues
getting things correct.
After I properly detect that SSE2/3 is available I need to set the
COmpiler Flags. For GCC it seems I should use "-msse2" or -msse3
flags. For MSVC it seems I should use /arch:SSE2. So I am trying to
append to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
by doing the following:
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-msse3")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-msse3")
for NON MSVC compilers and
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
for MSVC compilers. The problem seems to be that, at least on windows
that an extra ";" is also added, which makes sense as that is how
CMake handles the concatenation of lists. So how best to append to the
CMAKE_C_FLAGS?
Or should I be using the set_source_files_properties() for each file
that needs to have SSE compile flags/options turned on?
Thanks
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list