Skip to content

Commit

Permalink
更新CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
quqiOnfree committed Nov 24, 2023
1 parent b1c5c4a commit 8829249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Ignore Visual Studio temporary files, build results, and
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Expand Down Expand Up @@ -360,4 +360,7 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

# build
build/
27 changes: 4 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,12 @@

project(QuqiParser)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)

add_library(QuqiParser "src/Ini.cpp" "src/Json.cpp")
target_include_directories(QuqiParser PUBLIC include/)

target_include_directories(QuqiParser PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/QuqiParser>)

install(TARGETS
QuqiParser
EXPORT QuqiParser
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)

include(CMakePackageConfigHelpers)

configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/QuqiParserConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/QuqiParserConfig.cmake
INSTALL_DESTINATION lib/cmake
)
target_link_directories(QuqiParser INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

add_executable (test "test/test.cpp")
target_link_libraries(test PUBLIC QuqiParser)

if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET QuqiParser PROPERTY CXX_STANDARD 20)
set_property(TARGET test PROPERTY CXX_STANDARD 20)
endif()

0 comments on commit 8829249

Please sign in to comment.