CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) PROJECT (turbo_linecount) 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() FIND_PACKAGE (Threads REQUIRED) SET(CMAKE_CXX_FLAGS_RELEASE "-O3") SET(CMAKE_C_FLAGS_RELEASE "-O3") ADD_DEFINITIONS(-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64) ENDIF() 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) IF(THREADS_HAVE_PTHREAD_ARG) SET_PROPERTY(TARGET tlc PROPERTY COMPILE_OPTIONS "-pthread") SET_PROPERTY(TARGET tlc PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") ENDIF() TARGET_LINK_LIBRARIES (tlc turbo_linecount_static ${CMAKE_THREAD_LIBS_INIT}) INSTALL(TARGETS tlc DESTINATION "bin" ) INSTALL(TARGETS turbo_linecount turbo_linecount_static DESTINATION "lib" ) INSTALL(FILES src/turbo_linecount.h DESTINATION "include" )