Debian Codegraph @

src/engine/CMakeLists.txt

raw
1 ###########################################################################
2 # fheroes2: https://github.com/ihhub/fheroes2 #
3 # Copyright (C) 2022 - 2025 #
4 # #
5 # This program is free software; you can redistribute it and/or modify #
6 # it under the terms of the GNU General Public License as published by #
7 # the Free Software Foundation; either version 2 of the License, or #
8 # (at your option) any later version. #
9 # #
10 # This program is distributed in the hope that it will be useful, #
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13 # GNU General Public License for more details. #
14 # #
15 # You should have received a copy of the GNU General Public License #
16 # along with this program; if not, write to the #
17 # Free Software Foundation, Inc., #
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
19 ###########################################################################
20
21 file(GLOB_RECURSE LIBENGINE_SOURCES CONFIGURE_DEPENDS *.cpp)
22
23 add_compile_options("$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:${GNU_CC_WARN_OPTS}>")
24 add_compile_options("$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang,GNU>:${GNU_CXX_WARN_OPTS}>")
25 add_compile_options("$<$<OR:$<COMPILE_LANG_AND_ID:C,MSVC>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:${MSVC_CC_WARN_OPTS}>")
26
27 add_library(engine STATIC ${LIBENGINE_SOURCES})
28
29 target_compile_definitions(
30 engine
31 PRIVATE
32 # MSVC: suppress deprecation warnings
33 $<$<OR:$<COMPILE_LANG_AND_ID:C,MSVC>,$<COMPILE_LANG_AND_ID:CXX,MSVC>>:_CRT_SECURE_NO_WARNINGS>
34 $<$<CONFIG:Debug>:WITH_DEBUG>
35 $<$<BOOL:${ENABLE_IMAGE}>:WITH_IMAGE>
36 $<$<BOOL:${MACOS_APP_BUNDLE}>:MACOS_APP_BUNDLE>
37 )
38
39 target_include_directories(
40 engine
41 PUBLIC
42 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
43 )
44
45 target_link_libraries(
46 engine
47 smacker
48 ${USE_SDL_VERSION}::${USE_SDL_VERSION}
49 ${USE_SDL_VERSION}_mixer::${USE_SDL_VERSION}_mixer
50 $<$<BOOL:${ENABLE_IMAGE}>:${USE_SDL_VERSION}_image::${USE_SDL_VERSION}_image>
51 $<$<BOOL:${ENABLE_IMAGE}>:PNG::PNG>
52 Threads::Threads
53 ZLIB::ZLIB
54 )