2015-12-12 20:35:58 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
|
2015-12-13 04:09:13 +00:00
|
|
|
PROJECT (turbo_linecount)
|
2015-12-12 08:44:11 +00:00
|
|
|
|
2015-12-12 18:42:44 +00:00
|
|
|
IF(MSVC)
|
|
|
|
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
|
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "/Ox /Ob2")
|
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "/Ox /Ob2")
|
|
|
|
ELSE()
|
2015-12-13 01:14:53 +00:00
|
|
|
FIND_PACKAGE (Threads REQUIRED)
|
2015-12-12 20:35:58 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
2015-12-12 18:42:44 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "-O3")
|
2015-12-13 03:49:00 +00:00
|
|
|
ADD_DEFINITIONS(-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
|
2015-12-12 18:42:44 +00:00
|
|
|
ENDIF()
|
2015-12-12 09:43:23 +00:00
|
|
|
|
2015-12-13 04:09:13 +00:00
|
|
|
ADD_LIBRARY (turbo_linecount SHARED src/turbo_linecount.cpp src/turbo_linecount.h)
|
|
|
|
ADD_LIBRARY (turbo_linecount_static STATIC src/turbo_linecount.cpp src/turbo_linecount.h)
|
|
|
|
ADD_EXECUTABLE (tlc src/main.cpp)
|
2015-12-13 01:14:53 +00:00
|
|
|
|
|
|
|
IF(THREADS_HAVE_PTHREAD_ARG)
|
2015-12-13 04:09:13 +00:00
|
|
|
SET_PROPERTY(TARGET tlc PROPERTY COMPILE_OPTIONS "-pthread")
|
|
|
|
SET_PROPERTY(TARGET tlc PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
|
2015-12-13 01:14:53 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2015-12-13 04:09:13 +00:00
|
|
|
TARGET_LINK_LIBRARIES (tlc turbo_linecount_static ${CMAKE_THREAD_LIBS_INIT})
|
2015-12-12 09:43:23 +00:00
|
|
|
|
2015-12-13 04:09:13 +00:00
|
|
|
INSTALL(TARGETS tlc
|
2015-12-12 09:43:23 +00:00
|
|
|
DESTINATION "bin"
|
|
|
|
)
|
2015-12-13 04:09:13 +00:00
|
|
|
INSTALL(TARGETS turbo_linecount turbo_linecount_static
|
2015-12-12 09:43:23 +00:00
|
|
|
DESTINATION "lib"
|
|
|
|
)
|
2015-12-13 01:47:08 +00:00
|
|
|
INSTALL(FILES src/turbo_linecount.h
|
2015-12-12 09:43:23 +00:00
|
|
|
DESTINATION "include"
|
|
|
|
)
|