wisk / medusa

An open source interactive disassembler
Other
1.04k stars 92 forks source link

Conflicting C++11 flags when compiling with GCC #15

Closed Smjert closed 8 years ago

Smjert commented 10 years ago

medusa cmake file adds -std=c++11 flag for gcc but ogdf submodule uses -std=gnu++0x so the OpenMP flag test can't compile (and i suppose the same would happen with the project later).

wisk commented 10 years ago

I'm not sure to understand this problem, so don't hesitate to bring more information if I'm wrong. IIRC CMake doesn't provide a generic way to enable C++11 feature and I have no idea how to implement it properly. Do you think this test could fix this issue?

Smjert commented 10 years ago

The problem is that the medusa root CmakeLists.txt adds -std=c++11 flag if you use GCC (line 72 and 73) but ogdf projects adds -std=gnu++0x if you use GCC (line 33-34). Those are two conflicting flags that prevents cmake (and the project) to compile. It should be set only once in the medusa root project, and it should be set to c++11. I understand that the other project checks and adds the flag because you can compile it "alone", though there should be a way to check if the flag is already set, so if medusa set it, ogdf wont.

What you're saying is another issue: testing if a compiler support c++11 or not. But i don't think is necessary here because you are using c++11 code, so the flag should be enforced.

saeschdivara commented 9 years ago

I had the problem that for clang a false flag was added, so I am using some code from a dependency of your project which looks like this:

# Enable C++11
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR EMSCRIPTEN)
        list(APPEND CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
        list(APPEND CMAKE_CXX_FLAGS "-std=gnu++0x -fno-operator-names")
endif()
wisk commented 8 years ago

Hi,

It should be fixed with set(CMAKE_CXX_STANDARD 11), feel free to re-open this issue if it doesn't work.

Thanks