kde-extraapps/kcalc/CMakeLists.txt
Ivailo Monev ca6ec59cc7 generic: replace macro_log_feature() with set_package_properties() calls
other changes such as syncing properties, updating some of the URLs,
adding missing feature information, removing of redundant checks and
variables and indentation were done in the process while testing if the
changes work as intended.

replacing find_package() with macro_optional_find_package() was also done
where applicable however it's usage is questionable due to the CMake
`CMAKE_DISABLE_FIND_PACKAGE_<PACKAGE>` option.

there is a lot to be done, mostly updating package properties so I am
thinking of either providing a package properties file (like the
MacroLibrary) which sets properties for packages globablly or setting
package properties from the CMake modules shipped with kdelibs. the first
solution may override properties for packages if other projects define them
however a check to ensure that is not done should suffice. the second
solution will cover only DESCRIPTION and URL meaning PURPOSE and TYPE will
still have to be specified in the build systems.

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-21 05:37:28 +02:00

104 lines
2.3 KiB
CMake

project(kcalc)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
find_package(KDE4 4.19.0 REQUIRED)
include(KDE4Defaults)
include_directories(${KDE4_INCLUDES})
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
find_package(GMP)
set_package_properties(GMP PROPERTIES
DESCRIPTION "The GNU Multiple Precision Arithmetic Library"
URL "http://gmplib.org/"
PURPOSE "Required for building KCalc"
TYPE REQUIRED
)
include(CheckTypeSize)
include(CheckIncludeFiles)
check_include_files(ieeefp.h HAVE_IEEEFP_H)
check_type_size("signed long" SIZEOF_SIGNED_LONG)
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
configure_file(
config-kcalc.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-kcalc.h
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/knumber
${GMP_INCLUDE_DIR}
)
########### next target ###############
# Needs absolute paths due to the test program for knumber
set(libknumber_la_SRCS
${kcalc_SOURCE_DIR}/knumber/knumber.cpp
${kcalc_SOURCE_DIR}/knumber/knumber_error.cpp
${kcalc_SOURCE_DIR}/knumber/knumber_float.cpp
${kcalc_SOURCE_DIR}/knumber/knumber_fraction.cpp
${kcalc_SOURCE_DIR}/knumber/knumber_integer.cpp
${kcalc_SOURCE_DIR}/knumber/knumber_operators.cpp
)
add_subdirectory( knumber )
# add_subdirectory( tests )
set(kcalc_SRCS ${libknumber_la_SRCS}
kcalc.cpp
bitbutton.cpp
kcalc_bitset.cpp
kcalc_button.cpp
kcalc_const_button.cpp
kcalc_const_menu.cpp
kcalc_core.cpp
kcalcdisplay.cpp
stats.cpp
kcalc.ui
constants.ui
colors.ui
fonts.ui
general.ui
)
kde4_add_kcfg_files(kcalc_SRCS kcalc_settings.kcfgc)
add_executable(kcalc ${kcalc_SRCS})
target_link_libraries(kcalc
${KDE4_KDEUI_LIBS}
${QT_QTXML_LIBRARY}
${GMP_LIBRARIES}
)
install(TARGETS kcalc ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install(
PROGRAMS kcalc.desktop
DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR}
)
install(
FILES kcalc.kcfg
DESTINATION ${KDE4_KCFG_INSTALL_DIR}
)
install(
FILES kcalcui.rc
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kcalc
)
install(
FILES scienceconstants.xml
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kcalc
)
kde4_install_icons(${KDE4_ICON_INSTALL_DIR})