Closed rdp closed 5 years ago
I have this problem as well using CMake instead of the autotools build except in my case it is with /opt/local/lib/libcairo.dylib from MacPorts. I do not make universal/multiarch builds with MacPorts, and the CMake picks up this optional dependency. My usual workaround is to manually:
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -24,8 +24,8 @@ set(CMAKE_CXX_FLAGS "-Waddress -Wtype-limits -Wsign-compare")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wrestrict -arch x86_64 -arch i386")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wrestrict -arch x86_64 -arch i386")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wrestrict")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wrestrict")
endif ()
But I think we should change something to make a better out-of-the-box experience. I think i386 for mac is quite rare now. My Shotcut build uses autotools, which does not automatically try to do a multi-arch build.
I also get warning: unknown warning option '-Wrestrict' [-Wunknown-warning-option]
. So, why not simply remove these lines (this whole if block?) and let users override/set things as-needed using cmake properties?
Lastly, according to CMake docs, CFLAGS and CXXFLAGS from the environment are used to initialize CMAKE_C_FLAGS only if the CMakeLists.txt or cmake command line does not define CMAKE_C_FLAGS or CMAKE_CXX_FLAGS. So, there is an argument to also remove
set(CMAKE_C_FLAGS "-Waddress -Wtype-limits -Wsign-compare")
set(CMAKE_CXX_FLAGS "-Waddress -Wtype-limits -Wsign-compare")
I agree to remove all the cmake flags. For warnings and debugging purposes I have already setup special flags in the CI builds so we will still have visibility for those.