반응형
cmake`file (GLOB…)`패턴에서 단일 파일을 제외하려면 어떻게해야합니까?
내 CMakeLists.txt
내용은 다음과 같습니다.
file(GLOB lib_srcs Half/half.cpp Iex/*.cpp IlmThread/*.cpp Imath/*.cpp IlmImf/*.cpp)
그리고 IlmImf
폴더를 포함 b44ExpLogTable.cpp
내가 빌드에서 제외해야한다.
그것을 달성하는 방법?
이 list
함수를 사용하여 목록을 조작 할 수 있습니다. 예를 들면 다음과 같습니다.
list(REMOVE_ITEM <list> <value> [<value> ...])
귀하의 경우에는 다음과 같이 작동합니다.
list(REMOVE_ITEM lib_srcs "IlmImf/b44ExpLogTable.cpp")
FILTER는 경우에 따라 더 편리 할 수있는 또 다른 옵션입니다.
list(FILTER <list> <INCLUDE|EXCLUDE> REGEX <regular_expression>)
이 행은 필수 파일 이름으로 끝나는 모든 항목을 제외합니다.
list(FILTER lib_srcs EXCLUDE REGEX ".*b44ExpLogTable.cpp$")
다음은 cmake에 대한 정규식 사양 입니다.
The following characters have special meaning in regular expressions:
^ Matches at beginning of input
$ Matches at end of input
. Matches any single character
[ ] Matches any character(s) inside the brackets
[^ ] Matches any character(s) not inside the brackets
- Inside brackets, specifies an inclusive range between
characters on either side e.g. [a-f] is [abcdef]
To match a literal - using brackets, make it the first
or the last character e.g. [+*/-] matches basic
mathematical operators.
* Matches preceding pattern zero or more times
+ Matches preceding pattern one or more times
? Matches preceding pattern zero or once only
| Matches a pattern on either side of the |
() Saves a matched subexpression, which can be referenced
in the REGEX REPLACE operation. Additionally it is saved
by all regular expression-related commands, including
e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9).
반응형
'program story' 카테고리의 다른 글
IntelliJ에서 파일 저장시 gofmt 실행 (0) | 2020.10.28 |
---|---|
자바 스크립트 정규식 : 첫 번째 및 마지막 슬래시 제거 (0) | 2020.10.28 |
jekyll 로컬 개발 중에 site.url을 localhost로 변경하십시오. (0) | 2020.10.27 |
Ant에서 상대 경로를 절대 경로로 어떻게 변환합니까? (0) | 2020.10.27 |
Stream.allMatch ()가 빈 스트림에 대해 true를 반환하는 이유는 무엇입니까? (0) | 2020.10.27 |