From d70c60b7024675efb2d31e544fd9fe172a87b32c Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 17 Dec 2009 22:31:13 +0200 Subject: [PATCH] CMake - Fix Windows build. --- cli/CMakeLists.txt | 14 +++++++++++++- gui/CMakeLists.txt | 14 +++++++++++++- test/CMakeLists.txt | 14 +++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 29edd006b..10127b2ba 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -6,7 +6,19 @@ SET(CHECKCLI_SRCS main.cpp ) +# Windows needs additional shlwapi library +if (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib + shlwapi +) +else (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib +) +endif (WIN32 AND NOT CYGWIN) + include_directories (${CPPCHECK_SOURCE_DIR}/lib) ADD_EXECUTABLE(cppcheck ${CHECKCLI_SRCS}) -TARGET_LINK_LIBRARIES(cppcheck checklib) +TARGET_LINK_LIBRARIES(cppcheck ${CHECK_LIBS}) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index a8ac45ab8..59d8fe010 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -75,6 +75,18 @@ SET(CHECK_TRANS SET(CHECK_RCCS gui.qrc) +# Windows needs additional shlwapi library +if (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib + shlwapi +) +else (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib +) +endif (WIN32 AND NOT CYGWIN) + # Generate rules for building source files from the resources QT4_ADD_RESOURCES(CHECK_RCC_SRCS ${CHECK_RCCS}) @@ -94,5 +106,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) ADD_EXECUTABLE(gui ${CHECKGUI_SRCS} ${CHECK_MOC_SRCS} ${CHECK_UIS_H} ${CHECK_RCC_SRCS} ${CHECK_QM}) -TARGET_LINK_LIBRARIES(gui checklib ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(gui ${CHECK_LIBS} ${QT_LIBRARIES}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3bfebcc17..ee46dfeb8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -28,7 +28,19 @@ SET(CHECKTEST_SRCS testmathlib.cpp ) +# Windows needs additional shlwapi library +if (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib + shlwapi +) +else (WIN32 AND NOT CYGWIN) +set(CHECK_LIBS + checklib +) +endif (WIN32 AND NOT CYGWIN) + include_directories (${CPPCHECK_SOURCE_DIR}/lib) ADD_EXECUTABLE(test ${CHECKTEST_SRCS}) -TARGET_LINK_LIBRARIES(test checklib) +TARGET_LINK_LIBRARIES(test ${CHECK_LIBS})