Remove globs from CMake

pull/32/head
Kyle Schwarz 2020-09-02 12:19:17 -04:00
parent 8e999a0fb8
commit 12463ea2f4
1 changed files with 27 additions and 18 deletions

View File

@ -83,30 +83,40 @@ if(LIBICSNEO_BUILD_DOCS)
endif() endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
file(GLOB PLATFORM_SRC_EXTERNAL ${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/*.cpp) set(PLATFORM_SRC
file(GLOB PLATFORM_SRC_INTERNAL ${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/internal/*.cpp) platform/windows/pcap.cpp
set(PLATFORM_SRC ${PLATFORM_SRC_EXTERNAL} ${PLATFORM_SRC_INTERNAL}) platform/windows/registry.cpp
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") platform/windows/vcp.cpp
file(GLOB PLATFORM_SRC_DARWIN ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/darwin/*.cpp) platform/windows/internal/pcapdll.cpp
file(GLOB PLATFORM_SRC_POSIX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/*.cpp) )
set(PLATFORM_SRC ${PLATFORM_SRC_POSIX} ${PLATFORM_SRC_DARWIN}) else() # Darwin or Linux
else() # elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(PLATFORM_SRC
file(GLOB PLATFORM_SRC_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/linux/*.cpp) platform/posix/ftdi.cpp
file(GLOB PLATFORM_SRC_POSIX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/*.cpp) platform/posix/pcap.cpp
set(PLATFORM_SRC ${PLATFORM_SRC_POSIX} ${PLATFORM_SRC_LINUX}) platform/posix/stm32.cpp
)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
list(APPEND PLATFORM_SRC
platform/posix/darwin/stm32darwin.cpp
)
else() # Linux or other
list(APPEND PLATFORM_SRC
platform/posix/linux/stm32linux.cpp
)
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING message(WARNING
"There is no platform port defined for ${CMAKE_SYSTEM_NAME}!\n" "There is no platform port defined for ${CMAKE_SYSTEM_NAME}!\n"
"The Linux platform code will be used, as it will generally allow building, but some devices may not enumerate properly." "The Linux platform code will be used, as it will generally allow building, but some devices may not enumerate properly."
) )
endif() endif()
endif()
endif() endif()
if(LIBICSNEO_BUILD_EXAMPLES) if(LIBICSNEO_BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
set(COMMON_SRC set(SRC_FILES
communication/message/flexray/control/flexraycontrolmessage.cpp communication/message/flexray/control/flexraycontrolmessage.cpp
communication/message/neomessage.cpp communication/message/neomessage.cpp
communication/packet/flexraypacket.cpp communication/packet/flexraypacket.cpp
@ -123,10 +133,9 @@ set(COMMON_SRC
device/idevicesettings.cpp device/idevicesettings.cpp
device/devicefinder.cpp device/devicefinder.cpp
device/device.cpp device/device.cpp
${PLATFORM_SRC}
) )
set(SRC_FILES ${COMMON_SRC} ${PLATFORM_SRC})
# Generate build info header # Generate build info header
execute_process( execute_process(
COMMAND git rev-parse --abbrev-ref HEAD COMMAND git rev-parse --abbrev-ref HEAD