Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for NOTFOUND issue in some (or all) cases. #11

Closed
wants to merge 8 commits into from

Conversation

m-7761
Copy link
Contributor

@m-7761 m-7761 commented Jun 30, 2017

Check that the CMAKE_PCH_COMPILER_TARGETS is not empty.

You may not want to indent this, or might know how to fix the RANGE parameters instead. I'm new to Github and CMake.

In a nontrivial project tree the root may not have any targets, and some of the sub-directories might not use precompiled headers.

This appears to work for one precompiled header in one sub-directory. I will be back if sub-directories clash.

Check that the CMAKE_PCH_COMPILER_TARGETS is not empty.
This is unrelated to the pull-request, but may as well go into it.
@m-7761
Copy link
Contributor Author

m-7761 commented Jun 30, 2017

I ran into a second problem with -include not putting its path in quotes (2 commits.)

@m-7761
Copy link
Contributor Author

m-7761 commented Jul 14, 2017

WARNING: I have made subsequent unrelated commits since this pull-request. GitHub doesn't have a branch creation feature, and I was pretty new to Git/GitHub when I made this PR.

I don't know when or if I will branch of my fork's master. But I've since done extensive work to make MSVC work, beginning with another unrealized pull-request, and extending it to allow paths with spaces that led to many problems ( https://gitlab.kitware.com/cmake/cmake/issues/17060 ) that ultimately made CMake 3.9.0 a requirement (older versions run into MSVC bugs with quoted PCH and PDB paths.)

I also added a symlink trick so GCC doesn't error when/if the headers are included in the target sources. It requires yet another dependent target. (I was unhappy having to add conditional code to my own scripts to exclude headers from GCC targets.)

mick-p1982 added 2 commits July 15, 2017 11:29
…e. And use PRIVATE, because PCHs should not be inherited by linked targets. Also, undo any effort in the prior commits to enable headers in sources. (It's not happening.)
@m-7761 m-7761 closed this Jul 19, 2017
@m-7761
Copy link
Contributor Author

m-7761 commented Jul 19, 2017

I'm closing this; I kept wondering why if(length!=0) worked after I discovered EQUAL and I just realized that it wasn't working, and so the target properties were not being transferred.

I'm still working on this. It needs a lot of work to be functional, and I'm not if MSVC ever worked, because in my experience the PCH file is being deleted before the dependent target is built.

@nanoant
Copy link
Owner

nanoant commented Jul 19, 2017

Dear @mick-p1982 I really appreciate your effort. Unfortunately I had not enough time (and will) to review all your work, and I am very sorry for lack of my response.

Nevertheless, I always considered this CMakePCHCompiler as rather a hack, than a proper solution, thus I did not want to invest any more time in it, since last year when I have sent RFC for native PCH support in CMake:
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/12589

Especially now, when I am pretty busy at my new job, and I am no longer frequent CMake user.

Now I can see there is reactivated discussion about PCH here:
https://gitlab.kitware.com/cmake/cmake/issues/1260

So 🤞 for finding ultimate (native) solution.
Best,
Adam

@m-7761
Copy link
Contributor Author

m-7761 commented Jul 20, 2017

@nanoant I will keep at it, but there was a very serious bug in this pull-request (I got CMake syntax completely wrong, but it just seemed to work.)

I'm new to CMake, but I've already learned so much because I have to use precompiled-headers since my template heavy headers (converting XML Schema to C++ configuration files) will take GCC tools two days to build instead of 15 or 20 minutes! (Visual Studio 2015 is an order of magnitude more timely.)

I'm very close. I just know that users are much more likely to find your account, so whatever I can do to steer them to a more complete effort is a humanitarian gesture on my part :)

I will try again after a little while. If you want to fix the NOTFOUND bug yourself (or one aspect of it) it's very easy to add if(NOT 0 EQUAL length) ... endif() before the foreach loop in __watch_pch_last_hook and if not, well others can do so for themselves. (There are a lot more issues than this though, which maybe can be patched in an omnibus pull-request. I will make a branch next time. For some reason after I finally straightened out 20 different things on the MSVC side, it wants to delete the PCH file in-between the two targets' build steps. The PCH is there before Build, but gone after, without any console output.)

THANK YOU FOR DOING THIS FIRST BTW! I tried to do it a little myself, and I saw where the fundamental problems were, and I could see that this approach is the only way that made sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants