basic setup
This commit is contained in:
parent
e08a79f4da
commit
eef181434c
|
@ -1,19 +1,13 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(basiccmake LANGUAGES CXX)
|
project(kappachat LANGUAGES CXX)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
# keep PUBLIC dependencies in sync with cmake/config.cmake.in
|
find_package(deltachat-core REQUIRED)
|
||||||
#find_package(foo REQUIRED)
|
find_package(Qt6 REQUIRED COMPONENTS Widgets)
|
||||||
|
|
||||||
include(AddAutoformatTarget)
|
include(AddAutoformatTarget)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
add_subdirectory(src)
|
qt_standard_project_setup()
|
||||||
|
|
||||||
install(DIRECTORY include TYPE INCLUDE FILES_MATCHING PATTERN *.h)
|
add_subdirectory(src)
|
||||||
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets)
|
|
||||||
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}::
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
|
|
||||||
configure_file(cmake/config.cmake.in ${PROJECT_NAME}-config.cmake @ONLY)
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
|
|
||||||
|
|
16
cmake/Finddeltachat-core.cmake
Normal file
16
cmake/Finddeltachat-core.cmake
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
find_path(libdeltachat_INCLUDE_DIR deltachat.h)
|
||||||
|
mark_as_advanced(libdeltachat_INCLUDE_DIR)
|
||||||
|
|
||||||
|
find_library(libdeltachat_LIBRARY deltachat)
|
||||||
|
mark_as_advanced(libdeltachat_LIBRARY)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
deltachat-core DEFAULT_MSG libdeltachat_LIBRARY libdeltachat_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(deltachat-core_FOUND AND NOT TARGET deltachat-core::libdeltachat)
|
||||||
|
add_library(deltachat-core::libdeltachat SHARED IMPORTED)
|
||||||
|
set_target_properties(deltachat-core::libdeltachat PROPERTIES
|
||||||
|
IMPORTED_LOCATION ${libdeltachat_LIBRARY}
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${libdeltachat_INCLUDE_DIR})
|
||||||
|
endif()
|
|
@ -1,3 +0,0 @@
|
||||||
include(CMakeFindDependencyMacro)
|
|
||||||
#find_dependency(foo @foo_VERSION@ REQUIRED)
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
|
|
|
@ -3,19 +3,21 @@ add_executable(${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
)
|
deltachat-core::libdeltachat
|
||||||
target_include_directories(${PROJECT_NAME}
|
Qt6::Widgets
|
||||||
PUBLIC
|
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
||||||
)
|
)
|
||||||
target_compile_features(${PROJECT_NAME}
|
target_compile_features(${PROJECT_NAME}
|
||||||
PUBLIC
|
PRIVATE
|
||||||
cxx_std_20
|
cxx_std_20
|
||||||
)
|
)
|
||||||
target_compile_options(${PROJECT_NAME}
|
target_compile_options(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>:-Wall -Wextra>
|
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>:-Wall -Wextra>
|
||||||
)
|
)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
WIN32_EXECUTABLE ON
|
||||||
|
MACOSX_BUNDLE ON
|
||||||
|
)
|
||||||
|
install(TARGETS ${PROJECT_NAME})
|
||||||
|
|
||||||
add_autoformat_target(${PROJECT_NAME})
|
add_autoformat_target(${PROJECT_NAME})
|
||||||
|
|
11
src/main.cc
11
src/main.cc
|
@ -1,3 +1,10 @@
|
||||||
int main() {
|
#include <QApplication>
|
||||||
return 0;
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
QApplication app{argc, argv};
|
||||||
|
QMainWindow mainwindow;
|
||||||
|
|
||||||
|
mainwindow.show();
|
||||||
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue