Skip to content

Commit

Permalink
CMake:
Browse files Browse the repository at this point in the history
- Fix: complie error: C2220 warning C4819 in msvc
- Fix export cmake config bug:

  See https://cmake.org/cmake/help/v3.26/command/find_package.html?highlight=find_package#search-modes
  • Loading branch information
KangLin committed Apr 14, 2023
1 parent 1e23082 commit 43b2458
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)

include (InstallRequiredSystemLibraries)
install(TARGETS ${CMARK_INSTALL}
EXPORT cmark-gfm-extensions
EXPORT cmark-gfm-extensions-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
INCLUDES DESTINATION include
)

if (CMARK_SHARED OR CMARK_STATIC)
Expand All @@ -79,7 +80,7 @@ if (CMARK_SHARED OR CMARK_STATIC)
DESTINATION include
)

install(EXPORT cmark-gfm-extensions DESTINATION lib${LIB_SUFFIX}/cmake-gfm-extensions)
install(EXPORT cmark-gfm-extensions-config DESTINATION lib${LIB_SUFFIX}/cmake-gfm-extensions)
endif()

# Feature tests
Expand All @@ -104,7 +105,7 @@ if(MSVC)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX /wd4706 /wd4204 /wd4221 /wd4100 /D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /WX /wd4706 /wd4204 /wd4221 /wd4100 /D_CRT_SECURE_NO_WARNINGS")
elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -std=c99 -pedantic")
endif()
Expand Down
7 changes: 4 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ endif()
set(libdir lib${LIB_SUFFIX})

install(TARGETS ${PROGRAM} ${CMARK_INSTALL}
EXPORT cmark-gfm
EXPORT cmark-gfm-config
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${libdir}
ARCHIVE DESTINATION ${libdir}
INCLUDES DESTINATION include
)

if(CMARK_SHARED OR CMARK_STATIC)
Expand All @@ -175,7 +176,7 @@ if(CMARK_SHARED OR CMARK_STATIC)
DESTINATION include
)

install(EXPORT cmark-gfm DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
install(EXPORT cmark-gfm-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()

# Feature tests
Expand Down Expand Up @@ -204,7 +205,7 @@ if(MSVC)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX /wd4706 /wd4204 /wd4221 /wd4100 /D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /WX /wd4706 /wd4204 /wd4221 /wd4100 /D_CRT_SECURE_NO_WARNINGS")
elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -std=c99 -pedantic")
endif()
Expand Down

0 comments on commit 43b2458

Please sign in to comment.