comparison Resources/CMake/Utilities.cmake @ 520:7a16fb9a4ba5 am-touch-events

merge bgo-commands-codegen
author Alain Mazy <alain@mazy.be>
date Tue, 12 Mar 2019 14:50:14 +0100
parents 5055031f4a06
children dc5acb03ad93
comparison
equal deleted inserted replaced
503:77e0eb83ff63 520:7a16fb9a4ba5
1
2
3 macro(GetFilenameFromPath TargetVariable Path)
4 #message(STATUS "GetFilenameFromPath (1): Path = ${Path} TargetVariable = ${${TargetVariable}}")
5 string(REPLACE "\\" "/" PathWithFwdSlashes "${Path}")
6 string(REGEX REPLACE "^.*/" "" ${TargetVariable} "${PathWithFwdSlashes}")
7 #message(STATUS "GetFilenameFromPath (2): Path = ${Path} Path = ${PathWithFwdSlashes} TargetVariable = ${TargetVariable}")
8 endmacro()
9
10 macro(GetFilePathWithoutLastExtension TargetVariable FilePath)
11 string(REGEX REPLACE "(^.*)\\.([^\\.]+)" "\\1" ${TargetVariable} "${FilePath}")
12 #message(STATUS "GetFileNameWithoutLastExtension: FilePath = ${FilePath} TargetVariable = ${${TargetVariable}}")
13 endmacro()
14
15 macro(Test_GetFilePathWithoutLastExtension)
16 set(tmp "/prout/zi/goui.goui.cpp")
17 GetFilePathWithoutLastExtension(TargetVariable "${tmp}")
18 if(NOT ("${TargetVariable}" STREQUAL "/prout/zi/goui.goui"))
19 message(FATAL_ERROR "Test_GetFilePathWithoutLastExtension failed (1)")
20 else()
21 #message(STATUS "Test_GetFilePathWithoutLastExtension: <<OK>>")
22 endif()
23 endmacro()
24
25 Test_GetFilePathWithoutLastExtension()
26
27 macro(Test_GetFilenameFromPath)
28 set(tmp "/prout/../../dada/zi/goui.goui.cpp")
29 GetFilenameFromPath(TargetVariable "${tmp}")
30 if(NOT ("${TargetVariable}" STREQUAL "goui.goui.cpp"))
31 message(FATAL_ERROR "Test_GetFilenameFromPath failed")
32 else()
33 #message(STATUS "Test_GetFilenameFromPath: <<OK>>")
34 endif()
35 endmacro()
36
37 Test_GetFilenameFromPath()