CMakeLists.txt: shuffle things around

This commit is contained in:
Přemysl Eric Janouch 2021-11-01 10:34:28 +01:00
parent 8950a533b4
commit 082f1aa41c
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 17 additions and 18 deletions

View File

@ -155,34 +155,33 @@ if (WIN32)
list (APPEND logdiag_SOURCES share/logdiag.rc) list (APPEND logdiag_SOURCES share/logdiag.rc)
endif () endif ()
# Generate a configure file
add_definitions (-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36)
add_definitions (-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36)
configure_file (config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_BINARY_DIR})
# Generate marshallers # Generate marshallers
function (glib_genmarshal listfile prefix)
find_program (GLIB_GENMARSHAL_EXECUTABLE glib-genmarshal) find_program (GLIB_GENMARSHAL_EXECUTABLE glib-genmarshal)
if (NOT GLIB_GENMARSHAL_EXECUTABLE) if (NOT GLIB_GENMARSHAL_EXECUTABLE)
message (FATAL_ERROR "glib-genmarshal not found") message (FATAL_ERROR "glib-genmarshal not found")
endif () endif ()
function (glib_genmarshal listfile prefix) get_filename_component (_basename "${listfile}" NAME_WE)
get_filename_component (basename "${listfile}" NAME_WE) set (_command_base ${GLIB_GENMARSHAL_EXECUTABLE} --prefix ${prefix}
set (command_base ${GLIB_GENMARSHAL_EXECUTABLE} --prefix ${prefix}
"${listfile}") "${listfile}")
add_custom_command (OUTPUT ${basename}.c ${basename}.h add_custom_command (OUTPUT ${_basename}.c ${_basename}.h
COMMAND ${command_base} --body > ${basename}.c COMMAND ${_command_base} --body > ${_basename}.c
COMMAND ${command_base} --header > ${basename}.h COMMAND ${_command_base} --header > ${_basename}.h
DEPENDS "${listfile}" DEPENDS "${listfile}"
COMMENT "Generating marshallers source files" VERBATIM) COMMENT "Generating marshallers source files" VERBATIM)
endfunction () endfunction ()
glib_genmarshal (${PROJECT_SOURCE_DIR}/liblogdiag/ld-marshal.list ld_marshal) glib_genmarshal (${PROJECT_SOURCE_DIR}/liblogdiag/ld-marshal.list ld_marshal)
include_directories (${PROJECT_SOURCE_DIR}) # Generate a configure file
include_directories (${GTK3_INCLUDE_DIRS} ${Lua_INCLUDE_DIRS}) add_definitions (-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36)
add_definitions (-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36)
configure_file (config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}
${GTK3_INCLUDE_DIRS} ${Lua_INCLUDE_DIRS})
set (logdiag_LIBS ${GTK3_LIBRARIES} ${Lua_LIBRARIES} m) set (logdiag_LIBS ${GTK3_LIBRARIES} ${Lua_LIBRARIES} m)
if (WIN32) if (WIN32)