mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Made the CMake scripts read Makefile.inc. Needs testing I guess.
This commit is contained in:
parent
875c55d86b
commit
8cb8371011
@ -770,6 +770,50 @@ FUNCTION(SETUP_CURL_DEPENDENCIES TARGET_NAME)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
||||
# Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it).
|
||||
FUNCTION(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
|
||||
FILE(READ ${INPUT_FILE} MAKEFILE_INC_TEXT)
|
||||
STRING(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
STRING(REGEX REPLACE "\\\\\n" "§!§" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
STRING(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*\n)" "SET(\\1 \\2)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
STRING(REPLACE "§!§" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
STRING(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
FILE(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
|
||||
|
||||
### BUGGY METHOD 1
|
||||
# FILE(STRINGS Makefile.inc MAKEFILE_INC_TEXT)
|
||||
# STRING(REPLACE "# ./lib/Makefile.inc" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# STRING(REPLACE " " " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace tabs with spaces
|
||||
|
||||
# #STRING(REGEX MATCH "CSOURCES *=" AAA ${MAKEFILE_INC_TEXT})
|
||||
# #MESSAGE(STATUS ${AAA})
|
||||
|
||||
# STRING(REPLACE "CSOURCES =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# STRING(REPLACE "HHEADERS =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
|
||||
# STRING(REGEX REPLACE "[^ ]+\\.c" "" ${HEADERS_VAR} ${MAKEFILE_INC_TEXT}) # Remove source files and store into headers var
|
||||
# STRING(REGEX REPLACE " +" " " ${HEADERS_VAR} ${${HEADERS_VAR}})
|
||||
# STRING(REGEX REPLACE " " ";" ${HEADERS_VAR} ${${HEADERS_VAR}})
|
||||
|
||||
# STRING(REGEX REPLACE "[^ ]+\\.h" "" ${SOURCES_VAR} ${MAKEFILE_INC_TEXT}) # Remove headers and store into source files var
|
||||
# STRING(REGEX REPLACE " +" " " ${SOURCES_VAR} ${${SOURCES_VAR}})
|
||||
# STRING(REGEX REPLACE " " ";" ${SOURCES_VAR} ${${SOURCES_VAR}})
|
||||
|
||||
# SET(${HEADERS_VAR} ${${HEADERS_VAR}} PARENT_SCOPE)
|
||||
# SET(${SOURCES_VAR} ${${SOURCES_VAR}} PARENT_SCOPE)
|
||||
|
||||
### BUGGY METHOD 2
|
||||
# FILE(READ Makefile.inc MAKEFILE_INC_TEXT)
|
||||
# #STRING(REPLACE "\t" " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace tabs with spaces
|
||||
# #STRING(REGEX REPLACE "\n+" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Remove empty lines (allow a simplification in the script)
|
||||
# STRING(REGEX REPLACE "([A-Z]+)[\t ]*=[\t ]*" "SET(\\1 " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# #STRING(REGEX REPLACE "^(.*)[\t ]*[^\\]$" ")" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# STRING(REGEX REPLACE "([^\\])\n" "\\1)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# # STRING(REGEX REPLACE "CSOURCES *=" "SET(libCurl_SRCS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# # STRING(REGEX REPLACE "HHEADERS *=" "SET(libCurl_HEADERS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
# FILE(WRITE Makefile.inc.cmake ${MAKEFILE_INC_TEXT})
|
||||
ENDFUNCTION()
|
||||
|
||||
ADD_SUBDIRECTORY(lib)
|
||||
IF(BUILD_CURL_EXE)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
|
@ -5,110 +5,49 @@ CONFIGURE_FILE(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake
|
||||
CONFIGURE_FILE(config.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
SET(libCurl_HEADERS
|
||||
|
||||
TRANSFORM_MAKEFILE_INC("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
LIST(APPEND HHEADERS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||
${CURL_BINARY_DIR}/include/curl/curlbuild.h
|
||||
arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h
|
||||
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h
|
||||
if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h
|
||||
getinfo.h strequal.h krb4.h memdebug.h http_chunks.h
|
||||
strtok.h connect.h llist.h hash.h content_encoding.h share.h
|
||||
curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h
|
||||
strtoofft.h strerror.h inet_ntop.h curlx.h memory.h setup.h
|
||||
transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h
|
||||
tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h
|
||||
curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h
|
||||
)
|
||||
|
||||
SET(libCurl_SRCS
|
||||
# amigaos.c - does not build on AmigaOS
|
||||
base64.c
|
||||
connect.c
|
||||
content_encoding.c
|
||||
cookie.c
|
||||
curl_addrinfo.c
|
||||
curl_sspi.c
|
||||
dict.c
|
||||
easy.c
|
||||
escape.c
|
||||
file.c
|
||||
formdata.c
|
||||
ftp.c
|
||||
getenv.c
|
||||
getinfo.c
|
||||
gtls.c
|
||||
hash.c
|
||||
hostares.c
|
||||
hostasyn.c
|
||||
hostip4.c
|
||||
hostip6.c
|
||||
hostip.c
|
||||
hostsyn.c
|
||||
hostthre.c
|
||||
http.c
|
||||
http_chunks.c
|
||||
http_digest.c
|
||||
http_negotiate.c
|
||||
http_ntlm.c
|
||||
if2ip.c
|
||||
inet_ntop.c
|
||||
inet_pton.c
|
||||
krb4.c
|
||||
ldap.c
|
||||
llist.c
|
||||
md5.c
|
||||
# memdebug.c -not used
|
||||
mprintf.c
|
||||
multi.c
|
||||
netrc.c
|
||||
# nwlib.c - Not used
|
||||
parsedate.c
|
||||
progress.c
|
||||
rawstr.c
|
||||
security.c
|
||||
select.c
|
||||
sendf.c
|
||||
slist.c
|
||||
share.c
|
||||
socks.c
|
||||
speedcheck.c
|
||||
splay.c
|
||||
ssh.c
|
||||
sslgen.c
|
||||
ssluse.c
|
||||
strdup.c
|
||||
strequal.c
|
||||
strerror.c
|
||||
# strtok.c - specify later
|
||||
# strtoofft.c - specify later
|
||||
telnet.c
|
||||
tftp.c
|
||||
timeval.c
|
||||
transfer.c
|
||||
url.c
|
||||
version.c
|
||||
)
|
||||
|
||||
IF(MSVC)
|
||||
LIST(APPEND libCurl_SRCS libcurl.rc)
|
||||
LIST(APPEND CSOURCES libcurl.rc)
|
||||
ENDIF()
|
||||
|
||||
# if we have Kerberos 4, right now this is never on
|
||||
#OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
|
||||
IF(CURL_KRB4)
|
||||
SET(libCurl_SRCS ${libCurl_SRCS}
|
||||
krb4.c
|
||||
security.c
|
||||
)
|
||||
ENDIF(CURL_KRB4)
|
||||
# SET(CSOURCES
|
||||
# # memdebug.c -not used
|
||||
# # nwlib.c - Not used
|
||||
# # strtok.c - specify later
|
||||
# # strtoofft.c - specify later
|
||||
# )
|
||||
|
||||
#OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
|
||||
MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
|
||||
IF(CURL_MALLOC_DEBUG)
|
||||
SET(libCurl_SRCS ${libCurl_SRCS}
|
||||
memdebug.c
|
||||
)
|
||||
ENDIF(CURL_MALLOC_DEBUG)
|
||||
# # if we have Kerberos 4, right now this is never on
|
||||
# #OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
|
||||
# IF(CURL_KRB4)
|
||||
# SET(CSOURCES ${CSOURCES}
|
||||
# krb4.c
|
||||
# security.c
|
||||
# )
|
||||
# ENDIF(CURL_KRB4)
|
||||
|
||||
# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
|
||||
# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
|
||||
# IF(CURL_MALLOC_DEBUG)
|
||||
# SET(CSOURCES ${CSOURCES}
|
||||
# memdebug.c
|
||||
# )
|
||||
# ENDIF(CURL_MALLOC_DEBUG)
|
||||
|
||||
# # only build compat strtoofft if we need to
|
||||
# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
||||
# SET(CSOURCES ${CSOURCES}
|
||||
# strtoofft.c
|
||||
# )
|
||||
# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
||||
|
||||
IF(HAVE_FEATURES_H)
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
@ -128,56 +67,6 @@ IF(HAVE_FEATURES_H)
|
||||
COMPILE_FLAGS -D_BSD_SOURCE)
|
||||
ENDIF(HAVE_FEATURES_H)
|
||||
|
||||
#strtoll \
|
||||
#socket \
|
||||
#select \
|
||||
#strdup \
|
||||
#strstr \
|
||||
#strtok_r \
|
||||
#uname \
|
||||
#strcasecmp \
|
||||
#stricmp \
|
||||
#strcmpi \
|
||||
#gethostbyaddr \
|
||||
#gettimeofday \
|
||||
#inet_addr \
|
||||
#inet_ntoa \
|
||||
#inet_pton \
|
||||
#perror \
|
||||
#closesocket \
|
||||
#siginterrupt \
|
||||
#sigaction \
|
||||
#signal \
|
||||
#getpass_r \
|
||||
#strlcat \
|
||||
#getpwuid \
|
||||
#geteuid \
|
||||
#dlopen \
|
||||
#utime \
|
||||
#sigsetjmp \
|
||||
#basename \
|
||||
#setlocale \
|
||||
#ftruncate \
|
||||
#pipe \
|
||||
#poll \
|
||||
#getprotobyname \
|
||||
#getrlimit \
|
||||
#setrlimit \
|
||||
#fork
|
||||
|
||||
# only build compat strtok if we need to
|
||||
IF (NOT HAVE_STRTOK_R)
|
||||
SET(libCurl_SRCS ${libCurl_SRCS}
|
||||
strtok.c
|
||||
)
|
||||
ENDIF (NOT HAVE_STRTOK_R)
|
||||
|
||||
# only build compat strtoofft if we need to
|
||||
IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
||||
SET(libCurl_SRCS ${libCurl_SRCS}
|
||||
strtoofft.c
|
||||
)
|
||||
ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
|
||||
|
||||
# The rest of the build
|
||||
|
||||
@ -199,7 +88,7 @@ ENDIF()
|
||||
ADD_LIBRARY(
|
||||
${LIB_NAME}
|
||||
${CURL_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||
${libCurl_HEADERS} ${libCurl_SRCS}
|
||||
${HHEADERS} ${CSOURCES}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBS})
|
||||
|
@ -8,22 +8,8 @@ IF (NOT HUGEHELP_C_FILE)
|
||||
FILE(WRITE hugehelp.c "/* built-in manual is disabled, blank function */\n#include \"hugehelp.h\"\nvoid hugehelp(void) {}")
|
||||
ENDIF()
|
||||
|
||||
SET(CURLX_SOURCE
|
||||
${CURL_SOURCE_DIR}/lib/strtoofft.c
|
||||
${CURL_SOURCE_DIR}/lib/strdup.c
|
||||
${CURL_SOURCE_DIR}/lib/rawstr.c
|
||||
)
|
||||
|
||||
SET(CURL_SOURCE
|
||||
main.c hugehelp.c urlglob.c writeout.c writeenv.c
|
||||
getpass.c homedir.c curlutil.c
|
||||
)
|
||||
|
||||
SET(CURL_HEADERS
|
||||
hugehelp.h setup.h config-win32.h config-mac.h
|
||||
config-riscos.h urlglob.h version.h
|
||||
writeout.h writeenv.h getpass.h homedir.h curlutil.h
|
||||
)
|
||||
TRANSFORM_MAKEFILE_INC("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
IF(MSVC)
|
||||
LIST(APPEND CURL_SOURCE curl.rc)
|
||||
@ -31,13 +17,12 @@ ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(
|
||||
${EXE_NAME}
|
||||
${CURL_HEADERS}
|
||||
${CURL_SOURCE} ${CURLX_SOURCE}
|
||||
${curl_SOURCES}
|
||||
)
|
||||
|
||||
SOURCE_GROUP("cURLX source files" FILES ${CURLX_SOURCE})
|
||||
SOURCE_GROUP("cURL source files" FILES ${CURL_SOURCE})
|
||||
SOURCE_GROUP("cURL header files" FILES ${CURL_HEADERS})
|
||||
SOURCE_GROUP("cURLX source files" FILES ${CURLX_ONES})
|
||||
SOURCE_GROUP("cURL source files" FILES ${CURL_SOURCES})
|
||||
SOURCE_GROUP("cURL header files" FILES ${CURL_HFILES})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CURL_SOURCE_DIR}/lib # To be able to reach "setup_once.h"
|
||||
|
Loading…
Reference in New Issue
Block a user