Mercurial > hg > orthanc-stone
comparison Resources/CMake/Utilities.cmake @ 504:7cdb4634846c
Merge
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 26 Feb 2019 21:15:20 +0100 |
parents | 5055031f4a06 |
children | dc5acb03ad93 |
comparison
equal
deleted
inserted
replaced
460:4d8ac609fc33 | 504:7cdb4634846c |
---|---|
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() |