49 lines
1.3 KiB
CMake
49 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# Set the project name
|
|
project(ac VERSION 1.0 LANGUAGES CXX)
|
|
|
|
# Set the C++ standard
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
# Add source files
|
|
file(GLOB SOURCES "src/utils/*.cpp" "src/types/*.cpp" "src/nbt/*.cpp")
|
|
|
|
# Collect header files by directory
|
|
file(GLOB UTIL_HEADERS "src/utils/*.h")
|
|
file(GLOB TYPE_HEADERS "src/types/*.h")
|
|
file(GLOB NBT_HEADERS "src/nbt/*.h")
|
|
|
|
# Add a shared library target
|
|
add_library(ac SHARED ${SOURCES})
|
|
|
|
# Set properties for the library
|
|
set_target_properties(ac PROPERTIES
|
|
VERSION ${PROJECT_VERSION}
|
|
SOVERSION 1
|
|
)
|
|
# Optionally, add include directories if needed
|
|
# target_include_directories(ac PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
# Optionally, link to other libraries if needed
|
|
# target_link_libraries(ac PRIVATE some_library)
|
|
|
|
# Ensure installation directories are set correctly
|
|
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "Directory for include files")
|
|
|
|
# Install the shared library
|
|
install(TARGETS ac
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
)
|
|
|
|
# Install headers into specific directories
|
|
install(FILES ${UTIL_HEADERS}
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libac/util
|
|
)
|
|
install(FILES ${TYPE_HEADERS}
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libac/types
|
|
)
|
|
install(FILES ${NBT_HEADERS}
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libac/nbt
|
|
)
|