summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-boilerplate.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/opentrack-boilerplate.cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake35
1 files changed, 19 insertions, 16 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 32829279..5661e151 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -19,14 +19,14 @@ set(new-hier-path "#pragma once
set(hier-path-filename "${CMAKE_BINARY_DIR}/opentrack-library-path.h")
set(orig-hier-path "")
-if(EXISTS ${hier-path-filename})
+if(EXISTS "${hier-path-filename}")
file(READ ${hier-path-filename} orig-hier-path)
endif()
if(NOT (orig-hier-path STREQUAL new-hier-path))
- file(WRITE ${hier-path-filename} "${new-hier-path}")
+ file(WRITE "${hier-path-filename}" "${new-hier-path}")
endif()
-function(opentrack_glob_sources var)
+function(otr_glob_sources var)
set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB ${var}-c ${dir}/*.cpp ${dir}/*.c ${dir}/*.h ${dir}/*.hpp)
file(GLOB ${var}-res ${dir}/*.rc)
@@ -41,7 +41,7 @@ function(opentrack_glob_sources var)
endforeach()
endfunction()
-function(opentrack_qt n)
+function(otr_qt n)
qt5_wrap_cpp(${n}-moc ${${n}-c} OPTIONS --no-notes)
qt5_wrap_ui(${n}-uih ${${n}-ui})
qt5_add_resources(${n}-rcc ${${n}-rc})
@@ -52,7 +52,7 @@ function(opentrack_qt n)
set(${n}-all "${${n}-all}" PARENT_SCOPE)
endfunction()
-function(opentrack_fixup_subsystem n)
+function(otr_fixup_subsystem n)
if(MSVC)
if(SDK_CONSOLE_DEBUG)
set(subsystem CONSOLE)
@@ -69,19 +69,19 @@ function(opentrack_fixup_subsystem n)
endif()
endfunction()
-function(opentrack_compat target)
+function(otr_compat target)
if(NOT MSVC)
set_property(SOURCE ${${target}-moc} APPEND_STRING PROPERTY COMPILE_FLAGS "-w -Wno-error")
endif()
if(WIN32)
target_link_libraries(${target} dinput8 dxguid strmiids)
endif()
- opentrack_fixup_subsystem(${target})
+ otr_fixup_subsystem(${target})
endfunction()
include(CMakeParseArguments)
-function(opentrack_is_target_c_only ret srcs)
+function(otr_is_target_c_only ret srcs)
set(val TRUE)
foreach(i ${srcs})
get_filename_component(ext "${i}" EXT)
@@ -94,14 +94,14 @@ function(opentrack_is_target_c_only ret srcs)
set(${ret} "${val}" PARENT_SCOPE)
endfunction()
-function(opentrack_install_pdb_current_project)
+function(otr_install_pdb_current_project)
if(MSVC AND FALSE)
file(GLOB_RECURSE pdbs "${CMAKE_CURRENT_BINARY_DIR}/*.pdb")
install(FILES ${pdbs} DESTINATION "${subdir}" ${opentrack-perms})
endif()
endfunction()
-function(opentrack_boilerplate n)
+function(otr_module n)
message(STATUS "module ${n}")
cmake_parse_arguments(arg
"STATIC;NO-COMPAT;BIN;EXECUTABLE;NO-QT;WIN32-CONSOLE;NO-INSTALL"
@@ -110,14 +110,16 @@ function(opentrack_boilerplate n)
${ARGN}
)
if(NOT "${arg_UNPARSED_ARGUMENTS}" STREQUAL "")
- message(FATAL_ERROR "opentrack_boilerplate bad formals: ${arg_UNPARSED_ARGUMENTS}")
+ message(FATAL_ERROR "otr_module bad formals: ${arg_UNPARSED_ARGUMENTS}")
endif()
+ set(n "opentrack-${n}")
+
project(${n})
- opentrack_glob_sources(${n})
- opentrack_is_target_c_only(is-c-only "${${n}-all}")
+ otr_glob_sources(${n})
+ otr_is_target_c_only(is-c-only "${${n}-all}")
if(NOT (is-c-only OR arg_NO-QT))
- opentrack_qt(${n})
+ otr_qt(${n})
else()
set(arg_NO-QT TRUE)
endif()
@@ -148,6 +150,7 @@ function(opentrack_boilerplate n)
endif()
add_library(${n} ${link-mode} "${${n}-all}")
endif()
+ set_property(TARGET ${n} PROPERTY PREFIX "")
if(NOT arg_NO-QT)
target_link_libraries(${n} ${MY_QT_LIBS})
@@ -157,7 +160,7 @@ function(opentrack_boilerplate n)
target_link_libraries(${n} opentrack-api opentrack-options opentrack-compat)
endif()
- opentrack_compat(${n})
+ otr_compat(${n})
if(CMAKE_COMPILER_IS_GNUCXX)
set(c-props "-fvisibility=hidden")
@@ -186,7 +189,7 @@ function(opentrack_boilerplate n)
set(subdir "${opentrack-hier-pfx}")
install(TARGETS "${n}" ${opentrack-hier-str} ${opentrack-perms})
endif()
- opentrack_install_pdb_current_project()
+ otr_install_pdb_current_project()
endif()
endif()