crioux__turbo-linecount/CMakeLists.txt

54 lines
1.6 KiB
CMake
Raw Normal View History

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)
OPTION (USE_STATIC_RUNTIME "Use Static Runtime" OFF)
2015-12-12 18:42:44 +00:00
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "/Od /MDd")
SET(CMAKE_C_FLAGS_DEBUG "/Od /MDd")
SET(CMAKE_CXX_FLAGS_RELEASE "/Ox /Ob2 /MD")
SET(CMAKE_C_FLAGS_RELEASE "/Ox /Ob2 /MD")
# Force static runtime libraries
IF(USE_STATIC_RUNTIME)
MESSAGE("Using Static Runtime")
FOREACH(flag
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
ENDFOREACH()
ENDIF()
2015-12-12 18:42:44 +00:00
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-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
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-13 04:09:13 +00:00
INSTALL(TARGETS tlc
DESTINATION "bin"
)
2015-12-13 04:09:13 +00:00
INSTALL(TARGETS turbo_linecount turbo_linecount_static
DESTINATION "lib"
)
2015-12-13 01:47:08 +00:00
INSTALL(FILES src/turbo_linecount.h
DESTINATION "include"
)