aihwkit icon indicating copy to clipboard operation
aihwkit copied to clipboard

Use add_compile_options in cmake

Open diego-plan9 opened this issue 5 years ago • 0 comments

Description and motivation

Currently we are modifying CMAKE_CXX_FLAGS directly for setting compilation flags:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-narrowing -Wno-strict-overflow")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ftree-vectorize")

Proposed solution

It would be nice to use add_compile_options instead. It seems to support generator expressions that can be used for differentiating between release and debug, although the main blocker is that the flags end up being passed to the cuda compiler directly, which might result in an error (there seems to be a $<COMPILE_LANGUAGE:lang> that can be used in the generator expression)

Alternatives and other information

diego-plan9 avatar Nov 13 '20 10:11 diego-plan9