cmake: improves error detection
[src/app-framework-main.git] / src / CMakeLists.txt
index 807d30d..8971edb 100644 (file)
 # limitations under the License.
 ###########################################################################
 
+cmake_minimum_required(VERSION 2.8)
+
 include(FindPkgConfig)
 
 pkg_check_modules(EXTRAS REQUIRED
-       libzip>=0.11
        libxml-2.0
        openssl
        xmlsec1 xmlsec1-openssl
@@ -31,16 +32,37 @@ add_compile_options(${EXTRAS_CFLAGS})
 include_directories(${EXTRAS_INCLUDE_DIRS})
 link_libraries(${EXTRAS_LIBRARIES})
 
+if(USE_LIBZIP)
+       pkg_check_modules(LIBZIP REQUIRED libzip>=0.11)
+       add_compile_options(${LIBZIP_CFLAGS})
+       include_directories(${LIBZIP_INCLUDE_DIRS})
+       link_libraries(${LIBZIP_LIBRARIES})
+       add_definitions(-DUSE_LIBZIP=1)
+else(USE_LIBZIP)
+       add_definitions(-DUSE_LIBZIP=0)
+endif(USE_LIBZIP)
+
 ###########################################################################
 
-include_directories(simulation)
+if(USE_SIMULATION)
+       include_directories(simulation)
+else(USE_SIMULATION)
+       pkg_check_modules(SECMGR REQUIRED security-manager)
+       add_compile_options(${SECMGR_CFLAGS})
+       include_directories(${SECMGR_INCLUDE_DIRS})
+       link_libraries(${SECMGR_LIBRARIES})
+endif(USE_SIMULATION)
 
 ###########################################################################
 
-add_compile_options(-Wall -Wno-pointer-sign)
+add_compile_options(-Wall -Wextra -Wconversion)
+add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
+add_compile_options(-Werror=maybe-uninitialized)
+add_compile_options(-Werror=implicit-function-declaration)
+add_compile_options(-Wno-pointer-sign) # for XmlChar handling
 add_compile_options(-ffunction-sections -fdata-sections)
-add_compile_options(-fPIC)
 add_compile_options(-Wl,--gc-sections)
+add_compile_options(-fPIC)
 
 set(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
 set(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
@@ -56,6 +78,7 @@ add_library(wgtpkg
        wgtpkg-files.c
        wgtpkg-install.c
        wgtpkg-permissions.c
+       wgtpkg-uninstall.c
        wgtpkg-workdir.c
        wgtpkg-xmlsec.c
        wgtpkg-zip.c
@@ -64,6 +87,7 @@ add_library(wgtpkg
 add_library(utils
        utils-dir.c
        utils-jbus.c
+       utils-json.c
        verbose.c
        )
 
@@ -78,30 +102,31 @@ add_library(secwrp
        )
 
 add_library(afm
-       af-db.c
-       af-launch.c
-       af-run.c
+       afm-db.c
+       afm-launch.c
+       afm-launch-mode.c
+       afm-run.c
        )
 
 add_executable(wgtpkg-sign wgtpkg-sign.c)
 target_link_libraries(wgtpkg-sign wgtpkg utils)
 
-
 add_executable(wgtpkg-pack wgtpkg-pack.c)
 target_link_libraries(wgtpkg-pack wgtpkg utils)
 
-
 add_executable(wgtpkg-info wgtpkg-info.c)
 target_link_libraries(wgtpkg-info wgtpkg wgt utils)
 
-
 add_executable(wgtpkg-installer wgtpkg-installer.c)
 target_link_libraries(wgtpkg-installer wgtpkg wgt secwrp utils)
 
+add_executable(afm-user-daemon afm-user-daemon.c)
+target_link_libraries(afm-user-daemon afm secwrp wgt utils)
 
-add_executable(af-usrd af-usrd.c)
-target_link_libraries(af-usrd afm secwrp wgt utils)
+add_executable(afm-system-daemon afm-system-daemon.c)
+target_link_libraries(afm-system-daemon wgtpkg afm secwrp wgt utils)
 
 install(TARGETS wgtpkg-sign wgtpkg-pack wgtpkg-info wgtpkg-installer DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
-install(TARGETS af-usrd DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+install(TARGETS afm-user-daemon DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+install(TARGETS afm-system-daemon DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})