Work on CMake build system

Always configure files, doesn't hurt and makes CMakeLists.txt more readable
This commit is contained in:
Dirk Ziegelmeier 2018-04-26 23:31:31 +02:00
parent ad8e08a08b
commit d40c3251d7

View File

@ -222,18 +222,19 @@ set(lwipallapps_SRCS
${lwipmbedtls_SRCS}
)
# Generate lwip/init.h (version info)
configure_file(include/lwip/init.h.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/include/lwip/init.h)
# Documentation
set(DOXYGEN_IN ../doc/doxygen/lwip.Doxyfile.cmake.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/../doc/doxygen/lwip.Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})
option(LWIP_BUILD_DOCUMENTATION "Build documentation" OFF)
if(LWIP_BUILD_DOCUMENTATION)
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_IN ../doc/doxygen/lwip.Doxyfile.cmake.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/../doc/doxygen/lwip.Doxyfile)
# configure the file (version info)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})
message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target(lwipdocs ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
@ -241,12 +242,10 @@ if(LWIP_BUILD_DOCUMENTATION)
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
message("Doxygen needs to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
endif(LWIP_BUILD_DOCUMENTATION)
option(LWIP_CONFIGURE_FILES "Generate files configured by CMAKE (usually done by lwIP developers)" OFF)
if(LWIP_CONFIGURE_FILES)
# Generate Filelists.mk via cmake
function(lwip_gen_filelist_entries var_name filelist_var_name)
foreach(srcfile ${${filelist_var_name}})
@ -254,7 +253,6 @@ if(LWIP_CONFIGURE_FILES)
endforeach()
set(${var_name} "${tmp}" PARENT_SCOPE)
endfunction(lwip_gen_filelist_entries)
lwip_gen_filelist_entries("filelist_mk_COREFILES" "lwipcore_SRCS")
lwip_gen_filelist_entries("filelist_mk_CORE4FILES" "lwipcore4_SRCS")
lwip_gen_filelist_entries("filelist_mk_CORE6FILES" "lwipcore6_SRCS")
@ -262,7 +260,6 @@ if(LWIP_CONFIGURE_FILES)
lwip_gen_filelist_entries("filelist_mk_NETIFFILES" "lwipnetif_SRCS")
lwip_gen_filelist_entries("filelist_mk_SIXLOWPANFILES" "lwipsixlowpan_SRCS")
lwip_gen_filelist_entries("filelist_mk_PPPFILES" "lwipppp_SRCS")
lwip_gen_filelist_entries("filelist_mk_SNMPFILES" "lwipsnmp_SRCS")
lwip_gen_filelist_entries("filelist_mk_HTTPFILES" "lwiphttp_SRCS")
lwip_gen_filelist_entries("filelist_mk_MKFSDATAFILES" "lwipmakefsdata_SRCS")
@ -274,19 +271,14 @@ if(LWIP_CONFIGURE_FILES)
lwip_gen_filelist_entries("filelist_mk_TFTPFILES" "lwiptftp_SRCS")
lwip_gen_filelist_entries("filelist_mk_MQTTFILES" "lwipmqtt_SRCS")
lwip_gen_filelist_entries("filelist_mk_MBEDTLSFILES" "lwipmbedtls_SRCS")
configure_file(Filelists.mk.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/Filelists.mk)
configure_file(Filelists.mk.cmake.in
${CMAKE_CURRENT_SOURCE_DIR}/Filelists.mk)
# Generate lwip/init.h (version info)
configure_file(include/lwip/init.h.cmake.in
${CMAKE_CURRENT_SOURCE_DIR}/include/lwip/init.h)
endif(LWIP_CONFIGURE_FILES)
# lwIP libraries
add_library(lwipcore EXCLUDE_FROM_ALL ${lwipnoapps_SRCS})
add_library(lwipapps EXCLUDE_FROM_ALL ${lwipallapps_SRCS})
# when NOT cross-compiling, build makefsdata
if (NOT CMAKE_CROSSCOMPILING)
add_executable(makefsdata ${lwipmakefsdata_SRCS})
endif()