Skip to content

Commit

Permalink
Correct dependencies on generated header files
Browse files Browse the repository at this point in the history
This change corrects dependencies on generated defconfig.h and/or
convertconf.h header files because they must be generated before
compilation of conky.cc and main.cc if BUILD_BUILTIN_CONFIG and/or
BUILD_OLD_CONFIG are set.

Fixes: #1118
  • Loading branch information
arkamar authored and brndnmtthws committed Sep 10, 2022
1 parent 5d5ee12 commit 5797434
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ if(BUILD_BUILTIN_CONFIG)
${CMAKE_CURRENT_SOURCE_DIR}/${builtin_config}
defconfig.h defconfig
DEPENDS ${builtin_config})
add_custom_target(defconfig ALL DEPENDS defconfig.h)
set_source_files_properties(defconfig.h PROPERTIES GENERATED TRUE)
set(generated_hdr_files ${generated_hdr_files} defconfig.h)
endif(BUILD_BUILTIN_CONFIG)

if(BUILD_OLD_CONFIG)
Expand All @@ -40,6 +39,7 @@ if(BUILD_OLD_CONFIG)
${CMAKE_SOURCE_DIR}/extras/convert.lua
convertconf.h convertconf
DEPENDS ${CMAKE_SOURCE_DIR}/extras/convert.lua)
add_custom_target(convertconf ALL DEPENDS convertconf.h)
set_source_files_properties(convertconf.h PROPERTIES GENERATED TRUE)
set(generated_hdr_files ${generated_hdr_files} convertconf.h)
endif(BUILD_OLD_CONFIG)

add_custom_target(generated_hdr_files DEPENDS ${generated_hdr_files})
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,18 @@ endif(BUILD_HSV_GRADIENT)
if(BUILD_TESTS)
# Create a library strictly for testing
add_library(conky_core ${conky_sources} ${optional_sources})
add_dependencies(conky_core generated_hdr_files)
target_link_libraries(conky_core ${conky_libs})
add_executable(conky main.cc)
add_dependencies(conky generated_hdr_files)
target_link_libraries(conky conky_core ${conky_libs})
install(TARGETS conky_core
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
else()
add_executable(conky main.cc ${conky_sources} ${optional_sources})
add_dependencies(conky generated_hdr_files)
target_link_libraries(conky ${conky_libs})
endif()

Expand Down

0 comments on commit 5797434

Please sign in to comment.