forked from etc/pineapple-src
99 lines
3.1 KiB
Diff
Executable file
99 lines
3.1 KiB
Diff
Executable file
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index c708153..0e004da 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -60,10 +60,11 @@ include(GNUInstallDirs)
|
|
include(CTest)
|
|
include(FindThreads)
|
|
|
|
+find_package(ZLIB REQUIRED)
|
|
+if (0)
|
|
# Use pkg-config to create a PkgConfig::Ptex_ZLIB imported target
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_checK_modules(Ptex_ZLIB REQUIRED zlib IMPORTED_TARGET)
|
|
-
|
|
enable_testing()
|
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
@@ -77,6 +78,7 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "type of build" FORCE)
|
|
endif ()
|
|
endif ()
|
|
+endif()
|
|
|
|
if (NOT WIN32)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
|
@@ -99,7 +101,9 @@ endif ()
|
|
include_directories(src/ptex)
|
|
|
|
add_subdirectory(src/ptex)
|
|
+if (0)
|
|
add_subdirectory(src/utils)
|
|
add_subdirectory(src/tests)
|
|
add_subdirectory(src/doc)
|
|
+endif()
|
|
add_subdirectory(src/build)
|
|
diff --git a/src/ptex/CMakeLists.txt b/src/ptex/CMakeLists.txt
|
|
index ba3a3cc..1619ff1 100644
|
|
--- a/src/ptex/CMakeLists.txt
|
|
+++ b/src/ptex/CMakeLists.txt
|
|
@@ -1,6 +1,8 @@
|
|
-if (WIN32)
|
|
- add_definitions(/DPTEX_EXPORTS)
|
|
-endif (WIN32)
|
|
+if (BUILD_SHARED_LIBS)
|
|
+ add_definitions(-DPTEX_EXPORTS)
|
|
+else ()
|
|
+ add_definitions(-DPTEX_STATIC)
|
|
+endif ()
|
|
|
|
configure_file(PtexVersion.h.in
|
|
${CMAKE_CURRENT_SOURCE_DIR}/PtexVersion.h @ONLY)
|
|
@@ -18,29 +20,35 @@ set(SRCS
|
|
PtexWriter.cpp)
|
|
|
|
if(PTEX_BUILD_STATIC_LIBS)
|
|
- add_library(Ptex_static STATIC ${SRCS})
|
|
- set_target_properties(Ptex_static PROPERTIES OUTPUT_NAME Ptex)
|
|
- target_include_directories(Ptex_static
|
|
+ add_library(Ptex STATIC ${SRCS})
|
|
+ target_include_directories(Ptex
|
|
PUBLIC
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR})
|
|
- target_link_libraries(Ptex_static
|
|
- PUBLIC ${CMAKE_THREAD_LIBS_INIT} PkgConfig::Ptex_ZLIB)
|
|
- install(TARGETS Ptex_static EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
+ target_link_libraries(Ptex
|
|
+ PUBLIC ${CMAKE_THREAD_LIBS_INIT} ZLIB::ZLIB)
|
|
+ install(TARGETS Ptex EXPORT Ptex
|
|
+ RUNTIME DESTINATION bin
|
|
+ LIBRARY DESTINATION lib
|
|
+ ARCHIVE DESTINATION lib
|
|
+ )
|
|
endif()
|
|
|
|
if(PTEX_BUILD_SHARED_LIBS)
|
|
- add_library(Ptex_dynamic SHARED ${SRCS})
|
|
- set_target_properties(Ptex_dynamic PROPERTIES OUTPUT_NAME Ptex)
|
|
- target_include_directories(Ptex_dynamic
|
|
+ add_library(Ptex SHARED ${SRCS})
|
|
+ target_include_directories(Ptex
|
|
PUBLIC
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR})
|
|
- target_link_libraries(Ptex_dynamic
|
|
- PUBLIC ${CMAKE_THREAD_LIBS_INIT} PkgConfig::Ptex_ZLIB)
|
|
- install(TARGETS Ptex_dynamic EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
+ target_link_libraries(Ptex
|
|
+ PUBLIC ${CMAKE_THREAD_LIBS_INIT} ZLIB::ZLIB)
|
|
+ install(TARGETS Ptex EXPORT Ptex
|
|
+ RUNTIME DESTINATION bin
|
|
+ LIBRARY DESTINATION lib
|
|
+ ARCHIVE DESTINATION lib
|
|
+ )
|
|
endif()
|
|
|
|
install(FILES
|