From 3314caf0faf77b9ef725f54a3b8b71e331ed5597 Mon Sep 17 00:00:00 2001 From: Hui Peng Date: Sat, 27 Feb 2021 23:36:15 -0500 Subject: [PATCH] Cleanup the CMakeList.txt files --- CMakeLists.txt | 27 ++++++++++++++++++--------- lib/CUDD/CMakeLists.txt | 6 +++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f728815bb..6b91454fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,16 +11,25 @@ if(NOT COMMAND add_llvm_library) endif() if (DEFINED ENV{LLVM_DIR}) # We need to match the build environment for LLVM: - # In particular, we need C++11 and the -fno-rtti flag + # In particular, we need C++14 and the -fno-rtti flag set(CMAKE_CXX_STANDARD 14) - if(CMAKE_BUILD_TYPE MATCHES "Debug") - set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++14 -g -O0 -fno-rtti -Wno-deprecated -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8") - else() - set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++14 -O3 -fno-rtti -Wno-deprecated -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8") - endif() - set(CMAKE_C_FLAGS "-fPIC") - - find_package(LLVM REQUIRED CONFIG) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + # add -std=gnu++14 + set(CMAKE_CXX_EXTENSIONS ON) + + set(COMMON_FLAGS "-fPIC -Werror") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} -fno-rtti") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}") + + if(CMAKE_BUILD_TYPE MATCHES "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") + endif() + + find_package(LLVM REQUIRED CONFIG) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") include(AddLLVM) diff --git a/lib/CUDD/CMakeLists.txt b/lib/CUDD/CMakeLists.txt index 188ff7d1b..9d7f3c61c 100644 --- a/lib/CUDD/CMakeLists.txt +++ b/lib/CUDD/CMakeLists.txt @@ -39,7 +39,11 @@ set(SOURCES add_llvm_library(Cudd ${SOURCES} LINK_LIBS m) -set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8") +add_compile_definitions(HAVE_IEEE_754) +add_compile_definitions(SIZEOF_VOID_P=8) +add_compile_definitions(SIZEOF_LONG=8) + +set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast") if(DEFINED IN_SOURCE_BUILD) add_dependencies(Cudd intrinsics_gen)