# \`RegularExpression::compile(): Invalid range in \[\].\`

**URL:** https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707
**Category:** Usage
**Created:** [July 7, 2021, 4:22pm UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707 "2021-07-07T16:22:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SamuelMarks](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samuelmarks/32/1619_2.png) [@SamuelMarks](https://discourse.cmake.org/u/SamuelMarks)
#### Post date: [July 7, 2021, 4:22pm UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707/1 "2021-07-07T16:22:25Z")

</div>

from `include_directories("${CMAKE_CURRENT_BINARY_DIR}")`

* * *

I was debugging why no directory I specify in `target_include_directories` allow me to access the header after `generate_export_header`, even when explicitly specifying `EXPORT_FILE_NAME` and using angle brackets (with different path relativity).

One thing I finally tried was to output to `${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}_export.h` and adding that directory to the global search with `include_directories`. That’s when this error occurred. I’m assuming the error should be a different one (if an error at all).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 7, 2021, 10:04pm UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707/2 "2021-07-07T22:04:03Z")

</div>

What is the absolute path to your binary directory? Do you have `[` or `]` in the path anywhere?

---

<div class="post-metadata">

### Author: ![SamuelMarks](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samuelmarks/32/1619_2.png) [@SamuelMarks](https://discourse.cmake.org/u/SamuelMarks)
#### Post date: [July 10, 2021, 4:21am UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707/3 "2021-07-10T04:21:13Z")

</div>

No spaces and no `[` or `]` in the path. Windows. Short path.

---

<div class="post-metadata">

### Author: ![DenisSavasteev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/denissavasteev/32/4009_2.png) [@DenisSavasteev](https://discourse.cmake.org/u/DenisSavasteev)
#### Post date: [November 16, 2023, 9:37am UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707/4 "2023-11-16T09:37:34Z")

</div>

I had same problem. In my case absolute path contained non-ascii caharacters.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 17, 2023, 3:27pm UTC](https://discourse.cmake.org/t/regularexpression-compile-invalid-range-in/3707/5 "2023-11-17T15:27:56Z")

</div>

Can you please provide the path being used here?
