-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
115 lines (103 loc) · 2.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# This file is part of dirCompare
#
# Copyright 2017-2020 Thomas Erbesdobler <t.erbesdobler@team103.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
cmake_minimum_required(VERSION 2.8.8)
project(dirCompare)
# The version number
set(DIR_COMPARE_VERSION_MAJOR 0)
set(DIR_COMPARE_VERSION_MINOR 1)
# Compiler flags
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-gdwarf-2")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
set(CMAKE_CXX_FLAGS "/EHsc")
set(CMAKE_CXX_FLAGS_DEBUG "/MT /Od /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "/MT")
else ()
MESSAGE(WARNING "C++ Compiler ${CMAKE_CXX_COMPILER_ID} is not supported, compiler flags are not set")
endif ()
# Modules path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
# Options
option(WITH_TESTING "Build tests" OFF)
# Target platform
if (WIN32)
set(TARGET_PLATFORM "WINDOWS_WIN32")
else ()
set(TARGET_PLATFORM "LINUX")
endif ()
# Configure a header file for passing some of of the CMake settings
# to the source code
configure_file(
"${PROJECT_SOURCE_DIR}/dirCompareConfig.h.in"
"${PROJECT_BINARY_DIR}/dirCompareConfig.h"
)
include_directories("${PROJECT_BINARY_DIR}")
if (${TARGET_PLATFORM} STREQUAL WINDOWS_WIN32)
set(PLATFORM_SPECIFIC_SOURCES ${PLATFORM_SPECIFIC_SOURCES}
Win32File.cpp
Win32Directory.cpp
win32_charset_conversion.cpp
Win32ItemFactory.cpp
win32_security_tools.cpp
Win32SimpleFileComparison.cpp
Win32FullDirectoryComparison.cpp
Win32ComparisonFactory.cpp
)
elseif (${TARGET_PLATFORM} STREQUAL LINUX)
set(PLATFORM_SPECIFIC_SOURCES ${PLATFORM_SPECIFIC_SOURCES}
LinuxFile.cpp
LinuxDirectory.cpp
LinuxItemFactory.cpp
LinuxFileInfo.cpp
LinuxFileComparisonStrategy.cpp
LinuxDirectoryComparisonStrategy.cpp
LinuxSimpleFileComparison.cpp
LinuxComparisonFactory.cpp
)
endif ()
add_library(
libDirCompare OBJECT
ItemFactory.cpp
Item.cpp
File.cpp
Directory.cpp
InvalidItem.cpp
InvalidFile.cpp
InvalidDirectory.cpp
SimpleDirectoryComparison.cpp
ComparisonContext.cpp
ComparisonStrategyFactory.cpp
FileComparisonStrategy.cpp
DirectoryComparisonStrategy.cpp
SystemParameters.cpp
Token.cpp
Value.cpp
Keyword.cpp
Commandline.cpp
ignoring.cpp
platform.cpp
log.cpp
${PLATFORM_SPECIFIC_SOURCES}
)
add_executable(dirCompare main.cpp $<TARGET_OBJECTS:libDirCompare>)
add_executable(Win32Test Win32Test.cpp $<TARGET_OBJECTS:libDirCompare>)
# Testing
if (${WITH_TESTING})
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/testing")
endif ()