cmake_minimum_required(VERSION 2.8.5) project(ftplibcpp CXX) ###FIXME project(ftplibcpp) option(BUILD_SHARED_LIBS "Build shared libraries" off) add_definitions(-DNOLFS) add_definitions(-DNOSSL) # Where to put all the LIBRARY targets when built. This variable is used to # initialize the LIBRARY_OUTPUT_DIRECTORY property on all the targets. #FIXME set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) # Make sure the linker can find the ftpcpp library once it is built. link_directories(${LIBRARY_OUTPUT_PATH}) # Where to put all the RUNTIME targets when built. This variable is used to # initialize the RUNTIME_OUTPUT_DIRECTORY property on all the targets. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) # Tell CMake to build a library from ftplib.cpp and fetchurl.cpp add_library(ftpcpp ftplib.cpp fetchurl.cpp) set_target_properties(ftpcpp PROPERTIES DEBUG_POSTFIX D) if (NOT MSVC AND NOT MINGW ) if (NOT BUILD_SHARED_LIBS) # Create ftpcpp executable with NO dynamic dependency at all: # or for all execuatables: LDFLAGS=-static cmake .. set_target_properties(ftpcpp PROPERTIES LINK_FLAGS "-static") endif (NOT BUILD_SHARED_LIBS) else () set(LIBS wsock32) if (BUILD_SHARED_LIBS) target_link_libraries(ftpcpp ${LIBS}) endif (BUILD_SHARED_LIBS) endif () # install the lib install(TARGETS ftpcpp DESTINATION lib) # use the lib to build bin add_executable(ftpList ftpList.cpp) target_link_libraries(ftpList ftpcpp ${LIBS}) add_executable(ftpGet ftpGet.cpp) target_link_libraries(ftpGet ftpcpp ${LIBS}) add_executable(ftpPut ftpPut.cpp) target_link_libraries(ftpPut ftpcpp ${LIBS}) # install the bin install(TARGETS ftpPut ftpGet ftpList DESTINATION bin)