CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(primesieve)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)

file(GLOB SOURCE_FILES
     "src/*.c"
)

SET(CMAKE_C_FLAGS "-march=native -mtune=native -O2 -std=c99 -Wall -Wextra -flto")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto -fwhole-program")

FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
    MESSAGE(STATUS "OpenMP found and enabled")
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ELSE(OPENMP_FOUND)
    MESSAGE(STATUS "OpenMP not found")
ENDIF(OPENMP_FOUND)

MESSAGE(STATUS "Compiler flags: ${CMAKE_C_FLAGS}")
MESSAGE(STATUS "Linker flags: ${CMAKE_EXE_LINKER_FLAGS}")

ADD_EXECUTABLE(primesieve ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(primesieve m)


CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(primeburner)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)

file(GLOB SOURCE_FILES
     "src/*.c"
)

SET(CMAKE_C_FLAGS "-march=native -mtune=native -O2 -std=c99 -Wall -Wextra -flto")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto -fwhole-program")

FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
    MESSAGE(STATUS "OpenMP found and enabled")
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ELSE(OPENMP_FOUND)
    MESSAGE(STATUS "OpenMP not found")
ENDIF(OPENMP_FOUND)

MESSAGE(STATUS "Compiler flags: ${CMAKE_C_FLAGS}")
MESSAGE(STATUS "Linker flags: ${CMAKE_EXE_LINKER_FLAGS}")

ADD_EXECUTABLE(primeburner ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(primeburner m)


Rename project: primesieve -> primeburner
Rename project: primesieve -> primeburner
