From eee92c82ac2d61e03964d7ed94fd8e9d1b46ed57 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Tue, 29 Dec 2015 02:04:37 +0000 Subject: [PATCH] Always add all source files to targets Mark files which shouldn't be compiled as header-only, but still add them as sources so that they are visible in e.g. MSVS project tree. --- daemon/CMakeLists.txt | 6 ++++-- libtransmission/CMakeLists.txt | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index ef586374c..56b0d1fcc 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -20,13 +20,15 @@ include_directories( set(${PROJECT_NAME}_SOURCES daemon.c + daemon-posix.c + daemon-win32.c watch.c ) if(WIN32) - list(APPEND ${PROJECT_NAME}_SOURCES daemon-win32.c) + set_source_files_properties(daemon-posix.c PROPERTIES HEADER_FILE_ONLY ON) else() - list(APPEND ${PROJECT_NAME}_SOURCES daemon-posix.c) + set_source_files_properties(daemon-win32.c PROPERTIES HEADER_FILE_ONLY ON) endif() set(${PROJECT_NAME}_HEADERS diff --git a/libtransmission/CMakeLists.txt b/libtransmission/CMakeLists.txt index 5e6856211..d8ef7f37d 100644 --- a/libtransmission/CMakeLists.txt +++ b/libtransmission/CMakeLists.txt @@ -15,11 +15,15 @@ set(${PROJECT_NAME}_SOURCES ConvertUTF.c crypto.c crypto-utils.c + crypto-utils-cyassl.c crypto-utils-fallback.c - crypto-utils-${CRYPTO_PKG}.c + crypto-utils-openssl.c + crypto-utils-polarssl.c error.c fdlimit.c file.c + file-posix.c + file-win32.c handshake.c history.c inout.c @@ -51,6 +55,7 @@ set(${PROJECT_NAME}_SOURCES tr-getopt.c tr-lpd.c tr-udp.c + tr-utp.c upnp.c utils.c variant-benc.c @@ -62,10 +67,17 @@ set(${PROJECT_NAME}_SOURCES wildmat.c ) +set_source_files_properties(crypto-utils-fallback.c PROPERTIES HEADER_FILE_ONLY ON) +foreach(CP cyassl openssl polarssl) + if(NOT CP STREQUAL CRYPTO_PKG) + set_source_files_properties(crypto-utils-${CP}.c PROPERTIES HEADER_FILE_ONLY ON) + endif() +endforeach() + if(WIN32) - list(APPEND ${PROJECT_NAME}_SOURCES file-win32.c) + set_source_files_properties(file-posix.c PROPERTIES HEADER_FILE_ONLY ON) else() - list(APPEND ${PROJECT_NAME}_SOURCES file-posix.c) + set_source_files_properties(file-win32.c PROPERTIES HEADER_FILE_ONLY ON) endif() set(${PROJECT_NAME}_PUBLIC_HEADERS @@ -123,6 +135,7 @@ set(${PROJECT_NAME}_PRIVATE_HEADERS trevent.h tr-lpd.h tr-udp.h + tr-utp.h upnp.h variant-common.h verify.h @@ -130,9 +143,8 @@ set(${PROJECT_NAME}_PRIVATE_HEADERS webseed.h ) -if(ENABLE_UTP) - list(APPEND ${PROJECT_NAME}_SOURCES tr-utp.c) - list(APPEND ${PROJECT_NAME}_PRIVATE_HEADERS tr-utp.h) +if(NOT ENABLE_UTP) + set_source_files_properties(tr-utp.c PROPERTIES HEADER_FILE_ONLY ON) endif() add_definitions(