Discussion:
[CMake] include dirs from EPs not added to project for in-source builds on windows
Miklos Espak
2018-07-11 16:22:01 UTC
Permalink
Hi,

I have a "superbuild" project which builds two external projects (EP) and
then my actual project. It builds fine on linux and mac. On windows,
however, the build fails if the build directory is *inside* the source
folder.

Let's say e.g. that the sources are in "c:/src/myproject". If the build is
in "c:/src/myproject-build", it succeeds, but if it is in
"c:/src/myproject/build", it fails. (It took me a while until I discovered
the connection between the failures and the build dir path.)

With the build dir inside the source dir, I get compilation error because
header files are not found. In fact, if I open the "*.vcxproj" file of the
same target in the two types of builds, the
"<AdditionalIncludeDirectories>" elements are different. The include dirs
of the EPs are missing from it in the "in-source" build and they are there
in the "out-source" build.

This is how far I got with my debugging, and I'm not sure how to go on.

Unfortunately, I'd need to keep the build folder inside the sources because
the GitLab CI runners assume this.

Any help would be much appreciated.

I used CMake 3.11.4 and 3.12.0RC3.

Kind regards,
Miklos
Miklos Espak
2018-07-11 17:33:36 UTC
Permalink
G
Post by Miklos Espak
Hi,
I have a "superbuild" project which builds two external projects (EP) and
then my actual project. It builds fine on linux and mac. On windows,
however, the build fails if the build directory is *inside* the source
folder.
Let's say e.g. that the sources are in "c:/src/myproject". If the build is
in "c:/src/myproject-build", it succeeds, but if it is in
"c:/src/myproject/build", it fails. (It took me a while until I discovered
the connection between the failures and the build dir path.)
With the build dir inside the source dir, I get compilation error because
header files are not found. In fact, if I open the "*.vcxproj" file of the
same target in the two types of builds, the
"<AdditionalIncludeDirectories>" elements are different. The include dirs
of the EPs are missing from it in the "in-source" build and they are there
in the "out-source" build.
This is how far I got with my debugging, and I'm not sure how to go on.
Unfortunately, I'd need to keep the build folder inside the sources
because the GitLab CI runners assume this.
Any help would be much appreciated.
I used CMake 3.11.4 and 3.12.0RC3.
Kind regards,
Miklos
Miklos Espak
2018-07-11 17:34:43 UTC
Permalink
It was this generator: "Visual Studio 15 2017 Win64"
Post by Miklos Espak
Hi,
I have a "superbuild" project which builds two external projects (EP) and
then my actual project. It builds fine on linux and mac. On windows,
however, the build fails if the build directory is *inside* the source
folder.
Let's say e.g. that the sources are in "c:/src/myproject". If the build is
in "c:/src/myproject-build", it succeeds, but if it is in
"c:/src/myproject/build", it fails. (It took me a while until I discovered
the connection between the failures and the build dir path.)
With the build dir inside the source dir, I get compilation error because
header files are not found. In fact, if I open the "*.vcxproj" file of the
same target in the two types of builds, the
"<AdditionalIncludeDirectories>" elements are different. The include dirs
of the EPs are missing from it in the "in-source" build and they are there
in the "out-source" build.
This is how far I got with my debugging, and I'm not sure how to go on.
Unfortunately, I'd need to keep the build folder inside the sources
because the GitLab CI runners assume this.
Any help would be much appreciated.
I used CMake 3.11.4 and 3.12.0RC3.
Kind regards,
Miklos
Miklos Espak
2018-11-02 16:19:41 UTC
Permalink
Hi,

I ran into the same problem now on mac. It turned out that it has nothing
to do with CMake.

I apply some patches to the external projects with "git apply" instead of
"patch". But the EP sources are not in git, and if the superbuild dir is
inside the source dir, git apply recognises that it's inside a working dir
(of the main project) and it does not apply the patch. Strangely, it
returns 0 and does not print any error either, just goes on happily.

So, the include dirs were missing because the patch was not applied to the
EP. (The patch was to set them as a target property.)

Miklos
Post by Miklos Espak
Hi,
I have a "superbuild" project which builds two external projects (EP) and
then my actual project. It builds fine on linux and mac. On windows,
however, the build fails if the build directory is *inside* the source
folder.
Let's say e.g. that the sources are in "c:/src/myproject". If the build is
in "c:/src/myproject-build", it succeeds, but if it is in
"c:/src/myproject/build", it fails. (It took me a while until I discovered
the connection between the failures and the build dir path.)
With the build dir inside the source dir, I get compilation error because
header files are not found. In fact, if I open the "*.vcxproj" file of the
same target in the two types of builds, the
"<AdditionalIncludeDirectories>" elements are different. The include dirs
of the EPs are missing from it in the "in-source" build and they are there
in the "out-source" build.
This is how far I got with my debugging, and I'm not sure how to go on.
Unfortunately, I'd need to keep the build folder inside the sources
because the GitLab CI runners assume this.
Any help would be much appreciated.
I used CMake 3.11.4 and 3.12.0RC3.
Kind regards,
Miklos
Loading...