Don’t add_library(database) with an empty string, that’s not portable

Instead, don’t create the library at all if not needed.
This commit is contained in:
louiz’
2018-06-08 19:13:00 +02:00
parent 5ff3696d6f
commit e3730c5a40
+6 -6
View File
@@ -218,8 +218,6 @@ if(SQLITE3_FOUND OR PQ_FOUND)
include_directories(database ${PQ_INCLUDE_DIRS}) include_directories(database ${PQ_INCLUDE_DIRS})
endif() endif()
set(USE_DATABASE TRUE) set(USE_DATABASE TRUE)
else()
add_library(database OBJECT "")
endif() endif()
# #
@@ -235,8 +233,7 @@ add_executable(${PROJECT_NAME} src/main.cpp
$<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:xmpp>
$<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:bridge>
$<TARGET_OBJECTS:irc> $<TARGET_OBJECTS:irc>
$<TARGET_OBJECTS:identd> $<TARGET_OBJECTS:identd>)
$<TARGET_OBJECTS:database>)
## test_suite ## test_suite
file(GLOB source_tests file(GLOB source_tests
@@ -249,9 +246,12 @@ add_executable(test_suite ${source_tests}
$<TARGET_OBJECTS:xmpp> $<TARGET_OBJECTS:xmpp>
$<TARGET_OBJECTS:bridge> $<TARGET_OBJECTS:bridge>
$<TARGET_OBJECTS:irc> $<TARGET_OBJECTS:irc>
$<TARGET_OBJECTS:identd> $<TARGET_OBJECTS:identd>)
$<TARGET_OBJECTS:database>)
set_target_properties(test_suite PROPERTIES EXCLUDE_FROM_ALL TRUE) set_target_properties(test_suite PROPERTIES EXCLUDE_FROM_ALL TRUE)
if(USE_DATABASE)
target_link_libraries(${PROJECT_NAME} $<TARGET_OBJECTS:database>)
target_link_libraries(test_suite $<TARGET_OBJECTS:database>)
endif()
# #
## Link the executables with their libraries ## Link the executables with their libraries