diff options
| -rw-r--r-- | CMakeLists.txt | 11 | ||||
| -rw-r--r-- | lib/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 78 | 
3 files changed, 93 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a2090e2e2..71442e47e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,12 @@  # by [PUT YOUR REAL NAME TETEST!] and Sukender (Benoit Neil)  # TODO: -# Check on Linux, Mac +# Add tests sub project +# Add full (4 or 5 libs) SSL support +# Add INSTALL target +# Check on all possible platforms +# Test with as many configurations possible (With or without any option) +# Create scripts that help keeping the CMake build system up to date (to reduce maintenance)  # Add documentation subproject  CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2 FATAL_ERROR) @@ -734,7 +739,7 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC AND APPLE)  INCLUDE(CMake/OtherTests.cmake) -ADD_DEFINITIONS(-DHAVE_CONFIG_H -DCURL_STATICLIB) +ADD_DEFINITIONS(-DHAVE_CONFIG_H)  # For windows, do not allow the compiler to use default target (Vista).  IF(WIN32) @@ -746,7 +751,7 @@ IF(MSVC)  ENDIF(MSVC)  ADD_SUBDIRECTORY(lib) -# ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(src)  # This needs to be run very last so other parts of the scripts can take advantage of this.  IF(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f44abdf8b..b938000c0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -197,8 +197,10 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})  IF(CURL_STATICLIB) +	# Static lib  	SET(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC)  ELSE() +	# DLL / so dynamic lib  	SET(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED)  ENDIF() @@ -214,13 +216,17 @@ IF(WIN32)  	ADD_DEFINITIONS( -D_USRDLL )  ENDIF() +ADD_DEFINITIONS( +	-DBUILDING_LIBCURL +) +  IF(CURL_ZLIB AND ZLIB_FOUND)  	TARGET_LINK_LIBRARIES(${LIB_NAME} ${ZLIB_LIBRARIES})  	#ADD_DEFINITIONS( -DHAVE_ZLIB_H -DHAVE_ZLIB -DHAVE_LIBZ )  ENDIF()  # IF(CURL_SSL AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE) -	# LIST(APPEND DEPENDENCIES_NAMES OpenSSL) +	# TARGET_LINK_LIBRARIES(${LIB_NAME} ${OPENSSL_LIBRARIES})  	# ADD_DEFINITIONS( -DUSE_SSLEAY )  # ENDIF() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..168abf422 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,78 @@ +SET(EXE_NAME curl) + +# First try to locate hugehelp.c to see if it has already been created +# TODO Find the file WITHOUT adding a cache entry!!! Or else the user can delete the file after the script was first run, and the script won't notice it has gone. +FIND_FILE(HUGEHELP_C_FILE hugehelp.c PATHS . NO_DEFAULT_PATH) +IF (NOT HUGEHELP_C_FILE) +	MESSAGE(STATUS "Warning: hugehelp.c file was not generated before. Generating an 'empty' 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 +) + +IF(MSVC) +	LIST(APPEND CURL_SOURCE curl.rc) +ENDIF() + +ADD_EXECUTABLE( +	${EXE_NAME} +    ${CURL_HEADERS} +	${CURL_SOURCE} ${CURLX_SOURCE} +) + +SOURCE_GROUP("cURLX source files" FILES ${CURLX_SOURCE}) +SOURCE_GROUP("cURL source files" FILES ${CURL_SOURCE}) +SOURCE_GROUP("cURL header files" FILES ${CURL_HEADERS}) + +INCLUDE_DIRECTORIES( +    ${CURL_SOURCE_DIR}/lib		# To be able to reach "setup_once.h" +    ${CURL_BINARY_DIR}/lib		# To be able to reach "config.h" +	${CURL_BINARY_DIR}/include	# To be able to reach "curl/curlbuild.h" +) + + +# Setup dependencies + +IF(CURL_ZLIB AND ZLIB_FOUND) +	TARGET_LINK_LIBRARIES(${EXE_NAME} ${ZLIB_LIBRARIES}) +	#ADD_DEFINITIONS( -DHAVE_ZLIB_H -DHAVE_ZLIB -DHAVE_LIBZ ) +ENDIF() +# IF(CURL_SSL AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE) +	# TARGET_LINK_LIBRARIES(${EXE_NAME} ${OPENSSL_LIBRARIES}) +	# ADD_DEFINITIONS( -DUSE_SSLEAY ) +# ENDIF() +TARGET_LINK_LIBRARIES( ${EXE_NAME} libcurl ) + + +################################################################################ + +#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah") +#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah") +#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah") + +# Add the postfix to the executable since it is not added automatically as for modules and shared libraries +SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") + +IF(MSVC) +	IF(NOT BUILD_RELEASE_DEBUG_DIRS) +		# Ugly workaround to remove the "/debug" or "/release" in each output +		SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES PREFIX "../") +	ENDIF() +ENDIF() + +#INCLUDE(ModuleInstall OPTIONAL)  | 
