diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-23 09:42:23 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-23 09:49:28 +0200 | 
| commit | ab57277ad5a67d9267cf83c7df49bade163f90d6 (patch) | |
| tree | 534e18db373e677f532350fb060c722d374b8c02 | |
| parent | fadbc9f71f21e5147825dd5db7bf5e4c68a58178 (diff) | |
cmake{/gui,}: make boilerplate usable for building the executable
| -rw-r--r-- | cmake/opentrack-boilerplate.cmake | 32 | ||||
| -rw-r--r-- | cmake/opentrack-version.cmake | 4 | ||||
| -rw-r--r-- | gui/CMakeLists.txt | 20 | 
3 files changed, 21 insertions, 35 deletions
| diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 71c166f2..3875c46b 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -35,20 +35,19 @@ function(opentrack_compat target)      endif()  endfunction() -function(opentrack_boilerplate__ n files_ no-library_ static_ no-compat_ compile_ link_) -    set(link-mode SHARED) -    if (static_) -        set(link-mode STATIC) +function(opentrack_boilerplate__ n files_ no-library_ static_ no-compat_ compile_ link_ stage2_) +    if((NOT no-library_) AND (NOT stage2_)) +        set(link-mode SHARED) +        if (static_) +            set(link-mode STATIC) +        endif() +        add_library(${n} ${link-mode} ${files_}) +        opentrack_compat(${n})      endif() -    add_library(${n} ${link-mode} ${files_}) -    opentrack_compat(${n}) -    set(link-mode)      if(NOT no-compat_)          target_link_libraries(${n} opentrack-api opentrack-compat)      endif()      target_link_libraries(${n} ${MY_QT_LIBS}) -    set(c-props) -    set(l-props)      if(CMAKE_COMPILER_IS_GNUCXX)          set(c-props "-fvisibility=hidden -fuse-cxa-atexit")      endif() @@ -80,7 +79,7 @@ endfunction()  macro(opentrack_boilerplate n)      cmake_parse_arguments(${n}-args -        "NO-LIBRARY;STATIC;NO-COMPAT" +        "NO-LIBRARY;STATIC;NO-COMPAT;STAGE2"          "LINK;COMPILE"          ""          ${ARGN} @@ -88,15 +87,18 @@ macro(opentrack_boilerplate n)      if(NOT "${${n}-args_UNPARSED_ARGUMENTS}" STREQUAL "")          message(FATAL_ERROR "opentrack_boilerplate bad formals ${${n}-args_UNPARSED_ARGUMENTS}")      endif() -    project(${n}) -    opentrack_set_globs(${n}) -    opentrack_qt(${n}) -    if(NOT ${n}-args_NO-LIBRARY) +    if(NOT ${n}-args_STAGE2) +        project(${n}) +        opentrack_set_globs(${n}) +        opentrack_qt(${n}) +    endif() +    if((NOT ${n}-args_NO-LIBRARY) OR ${n}-args_STAGE2)          opentrack_boilerplate__("${n}" "${${n}-all}"                                         "${${n}-args_NO-LIBRARY}"                                         "${${n}-args_STATIC}"                                         "${${n}-args_NO-COMPAT}"                                         "${${n}-args_COMPILE}" -                                       "${${n}-args_LINK}") +                                       "${${n}-args_LINK}" +                                       "${${n}-args_STAGE2}")      endif()  endmacro() diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake index d753535f..b5b18ff0 100644 --- a/cmake/opentrack-version.cmake +++ b/cmake/opentrack-version.cmake @@ -10,9 +10,9 @@ unset(_build_type)  if(CMAKE_BUILD_TYPE)      string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)      if (NOT _build_type STREQUAL "DEBUG") -    	unset(_build_type) +        unset(_build_type)      else() -    	set(_build_type "${_build_type}-") +        set(_build_type "${_build_type}-")      endif()  endif() diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index e014e00b..3b2e60e1 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -10,9 +10,7 @@ else()      set(opentrack-win32-executable "")  endif() -opentrack_qt(opentrack)  add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) -opentrack_compat(opentrack)  if(NOT WIN32)      set_target_properties(opentrack PROPERTIES SUFFIX ".bin") @@ -21,8 +19,6 @@ endif()  target_link_libraries(opentrack      opentrack-spline-widget      opentrack-pose-widget -    opentrack-api -    opentrack-compat      opentrack-version  ) @@ -37,18 +33,6 @@ if(LINUX)      target_link_libraries(opentrack procps)  endif() -set(c-props) -set(l-props) -if(CMAKE_COMPILER_IS_GNUCXX) -    set(c-props "-fvisibility=hidden ") -    if(NOT APPLE) -        set(l-props "-Wl,--as-needed") -    endif() -endif() - -set_target_properties(opentrack PROPERTIES -    LINK_FLAGS "${l-props}" -    COMPILE_FLAGS "${c-props}" -) - +opentrack_boilerplate(opentrack STAGE2)  install(TARGETS opentrack DESTINATION .) + | 
