mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Fix compilation errors when using CMake to add a project through add_subdirectory.
This commit is contained in:
parent
2287b9ab0a
commit
7080918350
3
.gitignore
vendored
3
.gitignore
vendored
@ -18,3 +18,6 @@ win32/Debug
|
|||||||
win32/Release
|
win32/Release
|
||||||
win32/x64
|
win32/x64
|
||||||
extern/*
|
extern/*
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
out/
|
||||||
|
@ -15,18 +15,20 @@ set(ZINT_VERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}.${ZINT_VERSION_REL
|
|||||||
|
|
||||||
add_definitions(-DZINT_VERSION=\"${ZINT_VERSION}\")
|
add_definitions(-DZINT_VERSION=\"${ZINT_VERSION}\")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||||
|
|
||||||
option(ZINT_DEBUG "Set debug compile flags" OFF)
|
option(ZINT_DEBUG "Set debug compile flags" OFF)
|
||||||
option(ZINT_NOOPT "Set no optimize compile flags" OFF)
|
option(ZINT_NOOPT "Set no optimize compile flags" OFF)
|
||||||
option(ZINT_SANITIZE "Set sanitize compile/link flags" OFF)
|
option(ZINT_SANITIZE "Set sanitize compile/link flags" OFF)
|
||||||
option(ZINT_TEST "Set test compile flag" OFF)
|
option(ZINT_TEST "Set test compile flag" OFF)
|
||||||
option(ZINT_COVERAGE "Set code coverage flags" OFF)
|
option(ZINT_COVERAGE "Set code coverage flags" OFF)
|
||||||
option(ZINT_SHARED "Build shared library" ON)
|
option(ZINT_SHARED "Build shared library" ON)
|
||||||
option(ZINT_STATIC "Build static library" OFF)
|
option(ZINT_STATIC "Build static library" OFF)
|
||||||
option(ZINT_USE_PNG "Build with PNG support" ON)
|
option(ZINT_USE_PNG "Build with PNG support" ON)
|
||||||
option(ZINT_USE_QT "Build with Qt support" ON)
|
option(ZINT_USE_QT "Build with Qt support" ON)
|
||||||
option(ZINT_QT6 "If ZINT_USE_QT, use Qt6" OFF)
|
option(ZINT_QT6 "If ZINT_USE_QT, use Qt6" OFF)
|
||||||
|
option(ZINT_UNINSTALL "Add uninstall target" ON)
|
||||||
|
option(ZINT_FRONTEND "Build frontend" ON)
|
||||||
|
|
||||||
if(NOT ZINT_SHARED AND NOT ZINT_STATIC)
|
if(NOT ZINT_SHARED AND NOT ZINT_STATIC)
|
||||||
message(SEND_ERROR "Either ZINT_SHARED or ZINT_STATIC or both must be set")
|
message(SEND_ERROR "Either ZINT_SHARED or ZINT_STATIC or both must be set")
|
||||||
@ -143,7 +145,9 @@ if(NOT HAVE_GETOPT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(backend)
|
add_subdirectory(backend)
|
||||||
add_subdirectory(frontend)
|
if(ZINT_FRONTEND)
|
||||||
|
add_subdirectory(frontend)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT ZINT_USE_QT)
|
if(NOT ZINT_USE_QT)
|
||||||
message(STATUS "Qt support was disabled for this build")
|
message(STATUS "Qt support was disabled for this build")
|
||||||
@ -184,13 +188,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(
|
if(ZINT_UNINSTALL)
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
configure_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
IMMEDIATE @ONLY)
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
# staniek: don't install
|
# staniek: don't install
|
||||||
if(DATA_INSTALL_DIR)
|
if(DATA_INSTALL_DIR)
|
||||||
|
@ -372,6 +372,8 @@ extern "C" {
|
|||||||
# else
|
# else
|
||||||
# define ZINT_EXTERN extern
|
# define ZINT_EXTERN extern
|
||||||
# endif
|
# endif
|
||||||
|
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||||
|
# define ZINT_EXTERN extern __attribute__((visibility("default")))
|
||||||
#else
|
#else
|
||||||
# define ZINT_EXTERN extern
|
# define ZINT_EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,7 +17,7 @@ add_library(${PROJECT_NAME} STATIC ${QZint_SRCS})
|
|||||||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
|
||||||
VERSION ${ZINT_VERSION})
|
VERSION ${ZINT_VERSION})
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend")
|
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../backend")
|
||||||
|
|
||||||
if(ZINT_SHARED)
|
if(ZINT_SHARED)
|
||||||
target_link_libraries(${PROJECT_NAME} zint)
|
target_link_libraries(${PROJECT_NAME} zint)
|
||||||
|
@ -12,7 +12,7 @@ if(WIN32)
|
|||||||
target_sources(${PROJECT_NAME} PRIVATE zint.rc)
|
target_sources(${PROJECT_NAME} PRIVATE zint.rc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend")
|
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../backend")
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "zint")
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "zint")
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ endif()
|
|||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME} DESTINATION "${BIN_INSTALL_DIR}" RUNTIME)
|
install(TARGETS ${PROJECT_NAME} DESTINATION "${BIN_INSTALL_DIR}" RUNTIME)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
install(FILES "${CMAKE_SOURCE_DIR}/docs/zint.1" DESTINATION "${MAN_INSTALL_DIR}/man1" COMPONENT doc)
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../docs/zint.1" DESTINATION "${MAN_INSTALL_DIR}/man1" COMPONENT doc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ZINT_TEST)
|
if(ZINT_TEST)
|
||||||
|
@ -46,7 +46,7 @@ if(WIN32)
|
|||||||
target_sources(${PROJECT_NAME} PRIVATE res/qtZint.rc)
|
target_sources(${PROJECT_NAME} PRIVATE res/qtZint.rc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend" "${CMAKE_SOURCE_DIR}/backend_qt")
|
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../backend" "${CMAKE_CURRENT_SOURCE_DIR}/../backend_qt")
|
||||||
|
|
||||||
if(ZINT_SHARED)
|
if(ZINT_SHARED)
|
||||||
target_link_libraries(${PROJECT_NAME} zint)
|
target_link_libraries(${PROJECT_NAME} zint)
|
||||||
|
Loading…
Reference in New Issue
Block a user