58 lines
1.6 KiB
CMake
58 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(kindle2notes VERSION 1.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(KINDLE2NOTES_VERSION "${PROJECT_VERSION}")
|
|
find_package(Git QUIET)
|
|
if(Git_FOUND)
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty --always
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
RESULT_VARIABLE KINDLE2NOTES_GIT_RESULT
|
|
OUTPUT_VARIABLE KINDLE2NOTES_GIT_DESCRIBE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_QUIET
|
|
)
|
|
|
|
if(KINDLE2NOTES_GIT_RESULT EQUAL 0 AND NOT KINDLE2NOTES_GIT_DESCRIBE STREQUAL "")
|
|
if(KINDLE2NOTES_GIT_DESCRIBE MATCHES "^(.+)-0-g[0-9a-f]+$")
|
|
set(KINDLE2NOTES_VERSION "${CMAKE_MATCH_1}")
|
|
else()
|
|
set(KINDLE2NOTES_VERSION "${KINDLE2NOTES_GIT_DESCRIBE}")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
message(STATUS "kindle2notes version: ${KINDLE2NOTES_VERSION}")
|
|
|
|
function(kindle2notes_enable_warnings target)
|
|
if(MSVC)
|
|
target_compile_options(${target} PRIVATE /W4)
|
|
else()
|
|
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic)
|
|
endif()
|
|
endfunction()
|
|
|
|
add_executable(kindle2notes
|
|
typefactory/convertasciidoc.cpp
|
|
typefactory/convertasciidoc.h
|
|
typefactory/convertlatex.cpp
|
|
typefactory/convertlatex.h
|
|
typefactory/convertmarkdown.cpp
|
|
typefactory/convertmarkdown.h
|
|
typefactory/convertorg.cpp
|
|
typefactory/convertorg.h
|
|
typefactory/converter.cpp
|
|
typefactory/converter.h
|
|
typefactory/main.cpp
|
|
typefactory/typefactory.h
|
|
)
|
|
kindle2notes_enable_warnings(kindle2notes)
|
|
target_compile_definitions(kindle2notes PRIVATE
|
|
KINDLE2NOTES_VERSION="${KINDLE2NOTES_VERSION}"
|
|
)
|