From 7d6ed155232e7fa01e61f3f305b2faed5801a55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Fri, 2 Dec 2016 16:34:12 +0100 Subject: [PATCH] We only have to define the universal CXX flags once. --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bfe65b..e5db0e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,17 +16,23 @@ set(CMAKE_MODULE_PATH find_package(OpenMP REQUIRED) find_package(GMP REQUIRED) +include_directories( + ${GMP_INCLUDE_DIR}) + set(SRCS src/Main.cpp) set(CMAKE_CXX_FLAGS "-std=c++11 ${OpenMP_CXX_FLAGS} -fno-elide-constructors -pedantic-errors -Wall -Wextra -Werror -Wpedantic -Winit-self -Wmissing-declarations -Wuninitialized -Wfatal-errors") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -g -O3") -set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -Os") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3") +set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os") if(NOT CMAKE_BUILD_TYPE MATCHES Debug AND NOT CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) add_definitions(-DNDEBUG) endif() add_executable(${TARGET_NAME} ${SRCS}) + +target_link_libraries(${TARGET_NAME} + ${GMP_LIBRARY})