diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ba7679fe..4e52c8d9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,11 @@ cmake_minimum_required(VERSION 2.6) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow") +if (${CMAKE_BUILD_TYPE} MATCHES "Release") + message(STATUS "Enabling compiler optimizations") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native -O3 -flto") +endif () + find_package(Threads) find_library(TCMALLOC_LIBRARY NAMES tcmalloc /usr/lib /usr/local/lib) if (TCMALLOC_LIBRARY) @@ -20,7 +25,8 @@ else () message(STATUS "Valgrind headers not found -- disabling valgrind support") endif() -add_library(wan +add_executable(lwan + main.c lwan.c lwan-coro.c lwan-trie.c @@ -33,16 +39,7 @@ add_library(wan strbuf.c ) -target_link_libraries(wan - ${CMAKE_THREAD_LIBS_INIT}) -set_target_properties(wan - PROPERTIES PREFIX "l") - -add_executable(lwan - main.c) - target_link_libraries(lwan - wan ${CMAKE_THREAD_LIBS_INIT} ${TCMALLOC_LIBRARY} )