From 51d936bc9076e131b4e8b089c664251c3d2f2861 Mon Sep 17 00:00:00 2001 From: Saurabh Shrivastava Date: Sat, 3 Jun 2017 22:32:15 +0530 Subject: [PATCH] Fix CMake build for windows. Thank you linker flags for eating my 3+ hours. --- .gitignore | 2 +- src/CMakeLists.txt | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 57f03cbf..3b4c3c43 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ windows/enc_temp_folder/* #CMake src/cmake-build-debug/ -src/.idea +src/.idea/ #Autotools diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a37aa0c..887e0c58 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,14 +19,25 @@ configure_file ( include_directories ("${PROJECT_SOURCE_DIR}") -include_directories ("${PROJECT_SOURCE_DIR}/lib_ccx") -include_directories ("${PROJECT_SOURCE_DIR}/utf8proc") +include_directories ("${PROJECT_SOURCE_DIR}/lib_ccx/") +include_directories ("${PROJECT_SOURCE_DIR}/utf8proc/") include_directories ("${PROJECT_SOURCE_DIR}/gpacmp4/") include_directories ("${PROJECT_SOURCE_DIR}/protobuf-c/") -include_directories ("${PROJECT_SOURCE_DIR}/zvbi") -aux_source_directory ("${PROJECT_SOURCE_DIR}/zvbi" SOURCEFILE) -aux_source_directory ("${PROJECT_SOURCE_DIR}/zlib" SOURCEFILE) -aux_source_directory ("${PROJECT_SOURCE_DIR}/lib_hash" SOURCEFILE) +include_directories ("${PROJECT_SOURCE_DIR}/zvbi/") +include_directories ("${PROJECT_SOURCE_DIR}/lib_hash/") +aux_source_directory ("${PROJECT_SOURCE_DIR}/protobuf-c/" SOURCEFILE) +aux_source_directory ("${PROJECT_SOURCE_DIR}/zvbi/" SOURCEFILE) +aux_source_directory ("${PROJECT_SOURCE_DIR}/lib_hash/" SOURCEFILE) + +#Windows specific libraries and linker flags +if(WIN32) + include_directories ("${PROJECT_SOURCE_DIR}/win_iconv/") + include_directories ("${PROJECT_SOURCE_DIR}/libpng/") + aux_source_directory ("${PROJECT_SOURCE_DIR}/win_iconv/" SOURCEFILE) + aux_source_directory ("${PROJECT_SOURCE_DIR}/libpng/" SOURCEFILE) + set (EXTRA_LIBS ${EXTRA_LIBS} -lws2_32 -lwinmm) +endif(WIN32) + # Adding some platform specific library path link_directories (/opt/local/lib) @@ -40,7 +51,7 @@ set (EXTRA_LIBS ${EXTRA_LIBS} ccx) set (EXTRA_LIBS ${EXTRA_LIBS} m) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -set (EXTRA_LIBS ${EXTRA_LIBS} iconv) + set (EXTRA_LIBS ${EXTRA_LIBS} iconv) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")