diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a35ed2fb66e1533c606cffde00ab20b229d9858..d21c82cf04ebfca91d09273f67cbdd103d6887f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Copyright (c) 2014 CNRS
-# Author: Mathieu Geisert, Florent Lamiraux
+# Copyright (c) 2014, 2020 CNRS
+# Author: Mathieu Geisert, Florent Lamiraux, Guilhem Saurel
 #
 # This file is part of gepetto-viewer-corba.
 # gepetto-viewer-corba is free software: you can redistribute it
@@ -15,20 +15,19 @@
 # gepetto-viewer-corba.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-# Requires at least CMake 2.8 to configure the package.
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
 
 SET(PROJECT_NAME gepetto-viewer-corba)
 SET(PROJECT_DESCRIPTION "Corba server for gepetto-viewer")
 SET(PROJECT_URL "https://github.com/Gepetto/${PROJECT_NAME}")
 
+SET(PROJECT_USE_CMAKE_EXPORT TRUE)
 SET(CXX_DISABLE_WERROR true)
 
 INCLUDE(cmake/base.cmake)
 INCLUDE(cmake/idl.cmake)
 INCLUDE(cmake/python.cmake)
 INCLUDE(cmake/boost.cmake)
-INCLUDE(cmake/test.cmake)
 INCLUDE(cmake/apple.cmake)
 
 SET(CLIENT_ONLY FALSE CACHE BOOL "Set to true to install the client only")
@@ -55,10 +54,7 @@ SET(${PROJECT_NAME}_HEADERS
 # {{{ C++ server.
 IF(NOT CLIENT_ONLY)
   # {{{ Dependencies for the server.
-
-  # Tells pkg-config to read qtversion and cmake_plugin from pkg config file.
-  LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES qtversion cmake_plugin)
-  ADD_REQUIRED_DEPENDENCY("gepetto-viewer >= 4.3.0")
+  ADD_PROJECT_DEPENDENCY("gepetto-viewer" REQUIRED)
 
   # Get desired Qt version
   string(REPLACE "." ";" DESIRED_QT_VERSION_LIST ${GEPETTO_VIEWER_QTVERSION})
@@ -76,16 +72,18 @@ IF(NOT CLIENT_ONLY)
   SET(CMAKE_INCLUDE_CURRENT_DIR ON)
   IF(PROJECT_USE_QT4)
     FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtNetwork)
-    SET(PKG_CONFIG_EXTRA "qtversion=${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
+    SET(GEPETTO_VIEWER_CORBA_QTVERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
     INCLUDE(${QT_USE_FILE})
   ELSE(PROJECT_USE_QT4)
-    FOREACH (component "Core" "Widgets" "Gui" "Network" "Concurrent")
+      FOREACH (component "Core" "Widgets" "Gui" "Network" "Concurrent" "Xml" "OpenGL")
       FIND_PACKAGE ("Qt5${component}" REQUIRED)
       LIST(APPEND QT_INCLUDE_DIRS ${Qt5${component}_INCLUDE_DIRS})
       LIST(APPEND QT_LIBRARIES    ${Qt5${component}_LIBRARIES}   )
     ENDFOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Network")
-    SET(PKG_CONFIG_EXTRA "qtversion=${Qt5Core_VERSION}")
+    SET(GEPETTO_VIEWER_CORBA_QTVERSION "${Qt5Core_VERSION}")
   ENDIF(PROJECT_USE_QT4)
+  SET(PKG_CONFIG_EXTRA "qtversion=${GEPETTO_VIEWER_CORBA_QTVERSION}")
+  SET(PACKAGE_EXTRA_MACROS "set(GEPETTO_VIEWER_CORBA_QTVERSION ${GEPETTO_VIEWER_CORBA_QTVERSION})")
 
   INCLUDE_DIRECTORIES(SYSTEM ${EIGEN3_INCLUDE_DIRS} ${QT_INCLUDE_DIRS})
   # }}}
@@ -95,7 +93,6 @@ IF(NOT CLIENT_ONLY)
 
   # For backward compatibility
   SET(PKG_CONFIG_EXTRA "${PKG_CONFIG_EXTRA}\ncmake_plugin=${GEPETTO_VIEWER_CMAKE_PLUGIN}")
-  INCLUDE(${GEPETTO_VIEWER_CMAKE_PLUGIN})
   # }}}
 
   # {{{ Set list of headers
diff --git a/cmake b/cmake
index 7eca9ee6c9d1c4ee20eb82272e94f9d11642053a..a61ae61479a1d50d1ae3c988d1d9aaf20841173d 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit 7eca9ee6c9d1c4ee20eb82272e94f9d11642053a
+Subproject commit a61ae61479a1d50d1ae3c988d1d9aaf20841173d
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index e7aa5c3ae6a50cc2931562d1ca1baa4abc2a3881..7a43031a96071ee0305add4f477b5e4dfb9cd772 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Copyright (c) 2015 LAAS-CNRS
-# Author: Joseph Mirabel
+# Copyright (c) 2015, 2020 LAAS-CNRS
+# Author: Joseph Mirabel, Guilhem Saurel
 #
 # This file is part of SceneViewer-corba.
 # SceneViewer-corba is free software: you can redistribute it
@@ -20,7 +20,6 @@ SET(LIBRARY_NAME ${PROJECT_NAME})
 MACRO(ADD_EXAMPLE NAME SOURCE)
     ADD_EXECUTABLE (${NAME} ${SOURCE})
     TARGET_LINK_LIBRARIES(${NAME} ${LIBRARY_NAME})
-    PKG_CONFIG_USE_DEPENDENCY(${NAME} gepetto-viewer)
     PKG_CONFIG_USE_DEPENDENCY(${NAME} omniORB4)
 ENDMACRO()
 
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index ce6aae49e89e2302d6097d14f856683396f79015..b42201d507d57fb8530e642d393f573698699ef2 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -17,6 +17,4 @@
 # gepetto-viewer-corba  If not, see
 # <http://www.gnu.org/licenses/>.
 
-INCLUDE(${GEPETTO_VIEWER_CMAKE_PLUGIN})
-
 ADD_SUBDIRECTORY(omniorbserver)
diff --git a/plugins/omniorbserver/CMakeLists.txt b/plugins/omniorbserver/CMakeLists.txt
index 5dc07189003d67e9442bcac2a9f290f4fe395320..bb48b6ecd207e76fff938cbe1e21553c80f91c7b 100644
--- a/plugins/omniorbserver/CMakeLists.txt
+++ b/plugins/omniorbserver/CMakeLists.txt
@@ -46,6 +46,5 @@ GEPETTO_GUI_PLUGIN(omniorbserver
 
   # List of dependencies to be given to PKG_CONFIG_USE_DEPENDENCY
   PKG_CONFIG_DEPENDENCIES
-  "gepetto-viewer"
   "omniORB4"
   )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 35b6fdb0f0d5274d8e43ec77dfb85a01b6126ce1..93fc34f220229867975803e86056368d9565b3fc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Copyright (c) 2014-2016 LAAS-CNRS
-# Author: Mathieu Geisert
+# Copyright (c) 2014-2016, 2020 LAAS-CNRS
+# Author: Mathieu Geisert, Guilhem Saurel
 #
 # This file is part of SceneViewer-corba.
 # SceneViewer-corba is free software: you can redistribute it
@@ -115,16 +115,16 @@ ENDIF(NOT CLIENT_ONLY)
 # }}}
 
 ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${PROJECT_NAME}_SOURCES})
-TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PUBLIC ${CMAKE_BINARY_DIR}/src)
+TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PRIVATE ${CMAKE_BINARY_DIR}/src)
 ADD_DEPENDENCIES (${LIBRARY_NAME} generate_idl_cpp)
 ADD_DEPENDENCIES (${LIBRARY_NAME} generate_idl_python)
 IF(NOT CLIENT_ONLY)
-  PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} gepetto-viewer)
+  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} gepetto-viewer::gepetto-viewer)
 ENDIF(NOT CLIENT_ONLY)
 PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} omniORB4)
 TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${QT_LIBRARIES})
 
-INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION lib)
+INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
 
 # {{{ Python client: install Python files
 MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/gepetto/viewer/corba)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index baee862b98b91b2fb5da46b2b8659a6420ee055f..55a42342b75af89c788a174dfdc70117072b7594 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,6 +1,6 @@
-# Copyright 2016 CNRS-LAAS
+# Copyright 2016, 2020 CNRS-LAAS
 #
-# Author: Joseph Mirabel
+# Authors: Joseph Mirabel, Guilhem Saurel
 #
 # This file is part of hpp-gui
 # hpp-gui is free software: you can redistribute it and/or modify
@@ -29,19 +29,12 @@ IF(PROJECT_USE_QT4)
 ENDIF(PROJECT_USE_QT4)
 ADD_DEFINITIONS(${QT_DEFINITIONS})
 
-MACRO(ADD_TESTCASE NAME GENERATED)
-  IF (${GENERATED} STREQUAL TRUE)
-    ADD_UNIT_TEST(${NAME} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cc)
-  ELSE()
-    ADD_UNIT_TEST(${NAME} ${NAME}.cc)
-  ENDIF()
-
-  TARGET_LINK_LIBRARIES(${NAME} ${QT_LIBRARIES})
-  PKG_CONFIG_USE_DEPENDENCY(${NAME} gepetto-viewer)
-
+MACRO(ADD_TESTCASE NAME)
+  ADD_UNIT_TEST(${NAME} ${NAME}.cc)
+  TARGET_LINK_LIBRARIES(${NAME} ${QT_LIBRARIES} gepetto-viewer::gepetto-viewer)
 ENDMACRO(ADD_TESTCASE)
 
-ADD_TESTCASE (colormap FALSE)
-# ADD_TESTCASE (osgviewerQt FALSE)
+ADD_TESTCASE(colormap)
+# ADD_TESTCASE(osgviewerQt)
 
 ADD_PYTHON_UNIT_TEST("py-trivial" "tests/trivial.py" "src")