Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[cmake] reuse cor macros
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>
  • Loading branch information
Denis Zalevskiy committed Jan 20, 2015
1 parent de79566 commit bf7f438
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 38 deletions.
32 changes: 1 addition & 31 deletions CMakeLists.txt
Expand Up @@ -9,44 +9,14 @@ IF(NOT DEFINED LONG_VERSION OR LONG_VERSION STREQUAL "")
set(LONG_VERSION ${VERSION})
ENDIF(NOT DEFINED LONG_VERSION OR LONG_VERSION STREQUAL "")

option(ENABLE_MULTIARCH "Enable support for multi-arch distros (lib64)" OFF)
IF(ENABLE_MULTIARCH)
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX "")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX 64)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE()
SET(LIB_SUFFIX "")
ENDIF()
set(DST_LIB lib${LIB_SUFFIX})

message(STATUS "Version ${VERSION}")
message(STATUS "Long version is ${LONG_VERSION}")
message(STATUS "Multiarch is ${ENABLE_MULTIARCH}")

find_package(Cor REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Qt5Core REQUIRED)

set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fPIC -W -Wall -Wextra -Werror -g -O2 -std=c++0x")

#-Wno-psabi is to remove next g++ warning/note:
#the mangling of 'va_list' has changed in GCC 4.4
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-psabi")

# fix for gcc 4.6 specific compiling/linking issues, no dwarf-4
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -gdwarf-3"
)

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
)

pkg_check_modules(COR cor REQUIRED)

include_directories(
${COR_INCLUDE_DIRS}
)
Expand Down
10 changes: 8 additions & 2 deletions rpm/qtaround.spec
@@ -1,3 +1,5 @@
%{!?cmake_install: %global cmake_install make install DESTDIR=%{buildroot}}

Summary: QtAround library
Name: qtaround
Version: 0.0.0
Expand All @@ -7,7 +9,7 @@ Group: Development/Liraries
URL: https://github.com/nemomobile/qtaround
Source0: %{name}-%{version}.tar.bz2
BuildRequires: cmake >= 2.8
BuildRequires: pkgconfig(cor) >= 0.1.16
BuildRequires: pkgconfig(cor) >= 0.1.17
BuildRequires: pkgconfig(tut) >= 0.0.3
BuildRequires: pkgconfig(Qt5Core) >= 5.2.0
Requires(post): /sbin/ldconfig
Expand Down Expand Up @@ -48,7 +50,11 @@ License: LGPLv2.1
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name}-dbus = %{version}-%{release}
%if %{undefined suse_version}
Requires: btrfs-progs
%else
Requires: btrfsprogs
%endif
%description tests
%summary

Expand All @@ -61,7 +67,7 @@ make %{?jobs:-j%jobs}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=%{buildroot}
%cmake_install

%clean
rm -rf $RPM_BUILD_ROOT
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
@@ -1,3 +1,4 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC TRUE)

qt5_wrap_cpp(QTAROUND_MOC_SRC ${QTAROUND_MOC_HEADERS})
Expand Down
10 changes: 5 additions & 5 deletions tests/CMakeLists.txt
@@ -1,18 +1,19 @@
pkg_check_modules(TUT REQUIRED tut>=0.0.3)
include_directories(${TUT_INCLUDES})

find_package(Qt5Core REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC TRUE)
find_package(Qt5Core REQUIRED)

testrunner_project(qtaround)
set(UNIT_TESTS os dbus misc mt)
set(TESTS_DIR /opt/tests/qtaround)

MACRO(UNIT_TEST _name)
set(_exe_name test_${_name})
add_executable(${_exe_name} main.cpp ${_name}.cpp)
target_link_libraries(${_exe_name} qtaround ${COR_LIBRARIES})
qt5_use_modules(${_exe_name} Core)
install(TARGETS ${_exe_name} DESTINATION ${TESTS_DIR})
testrunner_install(TARGETS ${_exe_name})
ENDMACRO(UNIT_TEST)

foreach(t ${UNIT_TESTS})
Expand All @@ -33,8 +34,7 @@ target_link_libraries(test_dbus

configure_file(tests.xml.in tests.xml @ONLY)
FILE(GLOB SH_FILES *.sh)
install(PROGRAMS ${SH_FILES} DESTINATION ${TESTS_DIR})
install(FILES tests.xml DESTINATION ${TESTS_DIR})
testrunner_install(PROGRAMS ${SH_FILES})

# linking tests
add_executable(test-linking qtaround-link-main.cpp qtaround-link-2.cpp)
Expand Down

0 comments on commit bf7f438

Please sign in to comment.