Skip to content

Commit 0c57f77

Browse files
committed
Don't strictly require inih
inih isn't used by anything in liblcf directly, relaxing this requirement and allowing it to be disabled enables outside projects to more easily integrate this library into their application. This PR enables this while still making it the default, so the current behavior is the default one requiring no changes in existing apps (easyrpg-player)
1 parent 5e77d3e commit 0c57f77

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Diff for: CMakeLists.txt

+18-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include(MiscUtils)
88

99
# Compilation options
1010
option(BUILD_SHARED_LIBS "Build shared library, disable for building the static library (default: ON)" ON)
11+
option(LIBLCF_WITH_INIH "INI parsing support, (inih, default: ON)" ON)
1112
option(LIBLCF_WITH_ICU "ICU encoding handling (when disabled only windows-1252 is supported, default: ON)" ON)
1213
option(LIBLCF_WITH_XML "XML reading support (expat, default: ON)" ON)
1314
option(LIBLCF_UPDATE_MIMEDB "Whether to run update-mime-database after install (default: ON)" ON)
@@ -30,7 +31,6 @@ set(LCF_SOURCES
3031
src/dbarray.cpp
3132
src/dbstring_struct.cpp
3233
src/encoder.cpp
33-
src/inireader.cpp
3434
src/ldb_equipment.cpp
3535
src/ldb_eventcommand.cpp
3636
src/ldb_parameters.cpp
@@ -203,7 +203,6 @@ set(LCF_HEADERS
203203
src/lcf/encoder.h
204204
src/lcf/enum_tags.h
205205
src/lcf/flag_set.h
206-
src/lcf/inireader.h
207206
src/lcf/ldb/reader.h
208207
src/lcf/lmt/reader.h
209208
src/lcf/lmu/reader.h
@@ -295,6 +294,19 @@ set(LCF_HEADERS
295294
src/lcf/third_party/string_view.h
296295
)
297296

297+
298+
299+
set(LCF_SUPPORT_INIH 0)
300+
if(LIBLCF_WITH_INIH)
301+
list(APPEND LCF_SOURCES
302+
src/inireader.cpp
303+
)
304+
list(APPEND LCF_HEADERS
305+
src/lcf/inireader.h
306+
)
307+
set(LCF_SUPPORT_INIH 1)
308+
endif()
309+
298310
add_library(lcf ${LCF_SOURCES} ${LCF_HEADERS})
299311

300312
# IDE source grouping
@@ -345,8 +357,10 @@ set_property(TARGET lcf PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
345357
set_property(TARGET lcf PROPERTY EXPORT_NAME liblcf)
346358

347359
# inih
348-
find_package(inih REQUIRED)
349-
target_link_libraries(lcf inih::inih)
360+
if (LCF_SUPPORT_INIH)
361+
find_package(inih REQUIRED)
362+
target_link_libraries(lcf inih::inih)
363+
endif ()
350364

351365
# icu
352366
set(LCF_SUPPORT_ICU 0)

0 commit comments

Comments
 (0)