CMake target renaming to avoid C++ errors with `-`
This commit is contained in:
parent
195a4ef30d
commit
cfefc49c53
|
@ -24,8 +24,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
if(MSVC)
|
||||||
add_compile_options(/wd4131 /wd4127)
|
add_compile_options(/WX:NO /wd4131 /wd4127)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -29,7 +29,7 @@ install(
|
||||||
DESTINATION lib/cmake/Qtk
|
DESTINATION lib/cmake/Qtk
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
EXPORT qtk-export
|
EXPORT qtk_export
|
||||||
FILE QtkTargets.cmake
|
FILE QtkTargets.cmake
|
||||||
NAMESPACE Qtk::
|
NAMESPACE Qtk::
|
||||||
DESTINATION lib/cmake/Qtk
|
DESTINATION lib/cmake/Qtk
|
||||||
|
@ -43,6 +43,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.")
|
||||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk")
|
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk")
|
||||||
set(CPACK_SOURCE_IGNORE_FILES build;install;\.git;\.github;\.idea)
|
set(CPACK_SOURCE_IGNORE_FILES build;install;\.git;\.github;\.idea)
|
||||||
set(CPACK_PACKAGE_DIRECTORY packages/)
|
set(CPACK_PACKAGE_DIRECTORY packages/)
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
set(CPACK_BUNDLE_NAME Qtk)
|
||||||
|
#set(CPACK_BUNDLE_PLIST )
|
||||||
|
#set(CPACK_BUNDLE_ICON )
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CPACK_SOURCE_GENERATOR ZIP)
|
set(CPACK_SOURCE_GENERATOR ZIP)
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -23,16 +23,16 @@ set(
|
||||||
toolbox.h
|
toolbox.h
|
||||||
treeview.h
|
treeview.h
|
||||||
)
|
)
|
||||||
qt_add_library(qtk-plugin-library STATIC)
|
qt_add_library(qtk_plugin_library STATIC)
|
||||||
target_sources(
|
target_sources(
|
||||||
qtk-plugin-library PRIVATE
|
qtk_plugin_library PRIVATE
|
||||||
"${QTK_PLUGIN_LIBRARY_SOURCES}"
|
"${QTK_PLUGIN_LIBRARY_SOURCES}"
|
||||||
"${QTK_PLUGIN_LIBRARY_HEADERS}"
|
"${QTK_PLUGIN_LIBRARY_HEADERS}"
|
||||||
)
|
)
|
||||||
target_link_libraries(qtk-plugin-library PUBLIC Qt6::UiPlugin qtk-library)
|
target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS qtk-plugin-library
|
TARGETS qtk_plugin_library
|
||||||
BUNDLE DESTINATION lib
|
BUNDLE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
ARCHIVE DESTINATION lib/static
|
ARCHIVE DESTINATION lib/static
|
||||||
|
@ -40,7 +40,7 @@ install(
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS qtk-plugin-library
|
TARGETS qtk_plugin_library
|
||||||
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
|
@ -57,7 +57,7 @@ target_sources(
|
||||||
widgetplugincollection.cpp widgetplugincollection.h
|
widgetplugincollection.cpp widgetplugincollection.h
|
||||||
widgetplugin.cpp widgetplugin.h
|
widgetplugin.cpp widgetplugin.h
|
||||||
)
|
)
|
||||||
target_link_libraries(qtk_collection PUBLIC qtk-plugin-library)
|
target_link_libraries(qtk_collection PUBLIC qtk_plugin_library)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS qtk_collection
|
TARGETS qtk_collection
|
||||||
|
@ -84,11 +84,11 @@ configure_file(
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_executable(qtk-main ${QTK_APP_SOURCES})
|
qt_add_executable(qtk_main ${QTK_APP_SOURCES})
|
||||||
target_link_libraries(qtk-main PRIVATE qtk-plugin-library)
|
target_link_libraries(qtk_main PRIVATE qtk_plugin_library)
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
qtk-main PROPERTIES
|
qtk_main PROPERTIES
|
||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
@ -96,14 +96,14 @@ set_target_properties(
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS qtk-main
|
TARGETS qtk_main
|
||||||
BUNDLE DESTINATION bin
|
BUNDLE DESTINATION bin
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION bin/lib
|
LIBRARY DESTINATION bin/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_generate_deploy_app_script(
|
qt_generate_deploy_app_script(
|
||||||
TARGET qtk-main
|
TARGET qtk_main
|
||||||
FILENAME_VARIABLE QTK_DEPLOY_SCRIPT
|
FILENAME_VARIABLE QTK_DEPLOY_SCRIPT
|
||||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
NO_UNSUPPORTED_PLATFORM_ERROR
|
||||||
)
|
)
|
||||||
|
@ -121,16 +121,16 @@ if(WIN32)
|
||||||
|
|
||||||
if(TARGET Qt6::windeployqt)
|
if(TARGET Qt6::windeployqt)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET qtk-main
|
TARGET qtk_main
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}
|
COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}
|
||||||
COMMAND Qt6::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$<TARGET_FILE_DIR:qtk-main>/$<TARGET_FILE_NAME:qtk-main>"
|
COMMAND Qt6::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$<TARGET_FILE_DIR:qtk_main>/$<TARGET_FILE_NAME:qtk_main>"
|
||||||
)
|
)
|
||||||
install(DIRECTORY "${CMAKE_BINARY_DIR}/windeployqt/" DESTINATION bin)
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/windeployqt/" DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC AND TARGET Qt6::qmake)
|
if(MSVC AND TARGET Qt6::qmake)
|
||||||
set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk-main.vcxproj.user")
|
set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk_main.vcxproj.user")
|
||||||
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/extern/assimp/assimp/bin" assimp_bin)
|
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/extern/assimp/assimp/bin" assimp_bin)
|
||||||
file(WRITE ${VSUSER_FILE} "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
file(WRITE ${VSUSER_FILE} "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||||
file(APPEND ${VSUSER_FILE} "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n")
|
file(APPEND ${VSUSER_FILE} "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n")
|
||||||
|
|
|
@ -44,46 +44,46 @@ set(
|
||||||
)
|
)
|
||||||
|
|
||||||
qt6_add_big_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
qt6_add_big_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
||||||
qt_add_library(qtk-library STATIC)
|
qt_add_library(qtk_library STATIC)
|
||||||
target_sources(qtk-library PRIVATE ${QTK_LIBRARY_SOURCES})
|
target_sources(qtk_library PRIVATE ${QTK_LIBRARY_SOURCES})
|
||||||
target_sources(
|
target_sources(
|
||||||
qtk-library PUBLIC
|
qtk_library PUBLIC
|
||||||
FILE_SET HEADERS
|
FILE_SET HEADERS
|
||||||
BASE_DIRS "${CMAKE_SOURCE_DIR}/src"
|
BASE_DIRS "${CMAKE_SOURCE_DIR}/src"
|
||||||
FILES ${QTK_LIBRARY_PUBLIC_HEADERS}
|
FILES ${QTK_LIBRARY_PUBLIC_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(QTK_DEBUG)
|
if(QTK_DEBUG)
|
||||||
target_compile_definitions(qtk-library PUBLIC QTK_DEBUG)
|
target_compile_definitions(qtk_library PUBLIC QTK_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
qtk-library PROPERTIES
|
qtk_library PROPERTIES
|
||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
qtk-library PUBLIC
|
qtk_library PUBLIC
|
||||||
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
|
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
if(QTK_UPDATE_SUBMODULES OR NOT ASSIMP_NEW_INTERFACE)
|
if(QTK_UPDATE_SUBMODULES OR NOT ASSIMP_NEW_INTERFACE)
|
||||||
target_link_libraries(qtk-library PUBLIC assimp)
|
target_link_libraries(qtk_library PUBLIC assimp)
|
||||||
elseif(ASSIMP_NEW_INTERFACE)
|
elseif(ASSIMP_NEW_INTERFACE)
|
||||||
target_link_libraries(qtk-library PUBLIC assimp::assimp)
|
target_link_libraries(qtk_library PUBLIC assimp::assimp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(qtk-library PUBLIC OpenGL::GL)
|
target_link_libraries(qtk_library PUBLIC OpenGL::GL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# System install for qtk-library
|
# System install for qtk_library
|
||||||
install(
|
install(
|
||||||
TARGETS qtk-library
|
TARGETS qtk_library
|
||||||
# Associate qtk-library target with qtk-export
|
# Associate qtk_library target with qtk-export
|
||||||
EXPORT qtk-export
|
EXPORT qtk_export
|
||||||
FILE_SET HEADERS DESTINATION include
|
FILE_SET HEADERS DESTINATION include
|
||||||
BUNDLE DESTINATION lib
|
BUNDLE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
|
@ -92,9 +92,9 @@ install(
|
||||||
INCLUDES DESTINATION include
|
INCLUDES DESTINATION include
|
||||||
)
|
)
|
||||||
|
|
||||||
## Install qtk-library to Qt Designer to support widget plugins.
|
## Install qtk_library to Qt Designer to support widget plugins.
|
||||||
install(
|
install(
|
||||||
TARGETS qtk-library
|
TARGETS qtk_library
|
||||||
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
|
|
Loading…
Reference in New Issue