CMake is searching for packages in a strange location












0















I have been trying to track down why CMake find_package is finding the wrong package in my build. From CMake find_package: where did it find the package? I learned how to get it to tell me what paths it was searching, and thus where it found the package. But now I need to figure out why CMake is searching a certain path, because it is searching in a non-default location for some reason. I checked the variables



CMAKE_MODULE_PATH
CMAKE_PREFIX_PATH
CMAKE_INCLUDE_PATH
CMAKE_LIBRARY_PATH
CMAKE_PROGRAM_PATH


but they are empty. The variable



CMAKE_SYSTEM_PREFIX_PATH


is non-empty, but all it contains is



/usr/local;/usr;/;/usr;/tmp/pip-req-build-ckl98h8g/build/lib.linux-x86_64-3.6


so that is not the reason.



What else can make CMake search some strange prefix?



The exact problem is the following: find_package(yaml-cpp) is searching as follows:



  ...
Checking prefix [/]
Checking file [/yaml-cppConfig.cmake]
Checking file [/yaml-cpp-config.cmake]
Checking prefix [/usr/games/]
Checking file [/usr/games/yaml-cppConfig.cmake]
Checking file [/usr/games/yaml-cpp-config.cmake]
Checking prefix [/usr/local/games/]
Checking file [/usr/local/games/yaml-cppConfig.cmake]
Checking file [/usr/local/games/yaml-cpp-config.cmake]
Checking prefix [/snap/]
Checking file [/snap/yaml-cppConfig.cmake]
Checking file [/snap/yaml-cpp-config.cmake]
Checking prefix [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/]
Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cppConfig.cmake]
Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cpp-config.cmake]


It finds the package config file in that last path. But that is some private build directory of some other code, so I have no idea why find_package would search there. Some variable somewhere must have told it to do so, but I don't know which one. I do not want this path to be searched.










share|improve this question



























    0















    I have been trying to track down why CMake find_package is finding the wrong package in my build. From CMake find_package: where did it find the package? I learned how to get it to tell me what paths it was searching, and thus where it found the package. But now I need to figure out why CMake is searching a certain path, because it is searching in a non-default location for some reason. I checked the variables



    CMAKE_MODULE_PATH
    CMAKE_PREFIX_PATH
    CMAKE_INCLUDE_PATH
    CMAKE_LIBRARY_PATH
    CMAKE_PROGRAM_PATH


    but they are empty. The variable



    CMAKE_SYSTEM_PREFIX_PATH


    is non-empty, but all it contains is



    /usr/local;/usr;/;/usr;/tmp/pip-req-build-ckl98h8g/build/lib.linux-x86_64-3.6


    so that is not the reason.



    What else can make CMake search some strange prefix?



    The exact problem is the following: find_package(yaml-cpp) is searching as follows:



      ...
    Checking prefix [/]
    Checking file [/yaml-cppConfig.cmake]
    Checking file [/yaml-cpp-config.cmake]
    Checking prefix [/usr/games/]
    Checking file [/usr/games/yaml-cppConfig.cmake]
    Checking file [/usr/games/yaml-cpp-config.cmake]
    Checking prefix [/usr/local/games/]
    Checking file [/usr/local/games/yaml-cppConfig.cmake]
    Checking file [/usr/local/games/yaml-cpp-config.cmake]
    Checking prefix [/snap/]
    Checking file [/snap/yaml-cppConfig.cmake]
    Checking file [/snap/yaml-cpp-config.cmake]
    Checking prefix [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/]
    Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cppConfig.cmake]
    Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cpp-config.cmake]


    It finds the package config file in that last path. But that is some private build directory of some other code, so I have no idea why find_package would search there. Some variable somewhere must have told it to do so, but I don't know which one. I do not want this path to be searched.










    share|improve this question

























      0












      0








      0








      I have been trying to track down why CMake find_package is finding the wrong package in my build. From CMake find_package: where did it find the package? I learned how to get it to tell me what paths it was searching, and thus where it found the package. But now I need to figure out why CMake is searching a certain path, because it is searching in a non-default location for some reason. I checked the variables



      CMAKE_MODULE_PATH
      CMAKE_PREFIX_PATH
      CMAKE_INCLUDE_PATH
      CMAKE_LIBRARY_PATH
      CMAKE_PROGRAM_PATH


      but they are empty. The variable



      CMAKE_SYSTEM_PREFIX_PATH


      is non-empty, but all it contains is



      /usr/local;/usr;/;/usr;/tmp/pip-req-build-ckl98h8g/build/lib.linux-x86_64-3.6


      so that is not the reason.



      What else can make CMake search some strange prefix?



      The exact problem is the following: find_package(yaml-cpp) is searching as follows:



        ...
      Checking prefix [/]
      Checking file [/yaml-cppConfig.cmake]
      Checking file [/yaml-cpp-config.cmake]
      Checking prefix [/usr/games/]
      Checking file [/usr/games/yaml-cppConfig.cmake]
      Checking file [/usr/games/yaml-cpp-config.cmake]
      Checking prefix [/usr/local/games/]
      Checking file [/usr/local/games/yaml-cppConfig.cmake]
      Checking file [/usr/local/games/yaml-cpp-config.cmake]
      Checking prefix [/snap/]
      Checking file [/snap/yaml-cppConfig.cmake]
      Checking file [/snap/yaml-cpp-config.cmake]
      Checking prefix [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/]
      Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cppConfig.cmake]
      Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cpp-config.cmake]


      It finds the package config file in that last path. But that is some private build directory of some other code, so I have no idea why find_package would search there. Some variable somewhere must have told it to do so, but I don't know which one. I do not want this path to be searched.










      share|improve this question














      I have been trying to track down why CMake find_package is finding the wrong package in my build. From CMake find_package: where did it find the package? I learned how to get it to tell me what paths it was searching, and thus where it found the package. But now I need to figure out why CMake is searching a certain path, because it is searching in a non-default location for some reason. I checked the variables



      CMAKE_MODULE_PATH
      CMAKE_PREFIX_PATH
      CMAKE_INCLUDE_PATH
      CMAKE_LIBRARY_PATH
      CMAKE_PROGRAM_PATH


      but they are empty. The variable



      CMAKE_SYSTEM_PREFIX_PATH


      is non-empty, but all it contains is



      /usr/local;/usr;/;/usr;/tmp/pip-req-build-ckl98h8g/build/lib.linux-x86_64-3.6


      so that is not the reason.



      What else can make CMake search some strange prefix?



      The exact problem is the following: find_package(yaml-cpp) is searching as follows:



        ...
      Checking prefix [/]
      Checking file [/yaml-cppConfig.cmake]
      Checking file [/yaml-cpp-config.cmake]
      Checking prefix [/usr/games/]
      Checking file [/usr/games/yaml-cppConfig.cmake]
      Checking file [/usr/games/yaml-cpp-config.cmake]
      Checking prefix [/usr/local/games/]
      Checking file [/usr/local/games/yaml-cppConfig.cmake]
      Checking file [/usr/local/games/yaml-cpp-config.cmake]
      Checking prefix [/snap/]
      Checking file [/snap/yaml-cppConfig.cmake]
      Checking file [/snap/yaml-cpp-config.cmake]
      Checking prefix [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/]
      Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cppConfig.cmake]
      Checking file [/home/farmer/repos/gambit/copy3/build/contrib/yaml-cpp-0.6.2/yaml-cpp-config.cmake]


      It finds the package config file in that last path. But that is some private build directory of some other code, so I have no idea why find_package would search there. Some variable somewhere must have told it to do so, but I don't know which one. I do not want this path to be searched.







      cmake cmake-modules






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 12:34









      Ben FarmerBen Farmer

      824517




      824517
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Ok I think the answer is that CMake follows a horribly complicated procedure to search all over the place for packages. In my case it seems that it found something under



          ~/.cmake/packages/<package>


          which then must have directed it to the strange prefix I was seeing. Deleting this package registry entry fixed the problem. The full search procedure that CMake follows is described towards the end of the find_package documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412161%2fcmake-is-searching-for-packages-in-a-strange-location%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Ok I think the answer is that CMake follows a horribly complicated procedure to search all over the place for packages. In my case it seems that it found something under



            ~/.cmake/packages/<package>


            which then must have directed it to the strange prefix I was seeing. Deleting this package registry entry fixed the problem. The full search procedure that CMake follows is described towards the end of the find_package documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html






            share|improve this answer




























              0














              Ok I think the answer is that CMake follows a horribly complicated procedure to search all over the place for packages. In my case it seems that it found something under



              ~/.cmake/packages/<package>


              which then must have directed it to the strange prefix I was seeing. Deleting this package registry entry fixed the problem. The full search procedure that CMake follows is described towards the end of the find_package documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html






              share|improve this answer


























                0












                0








                0







                Ok I think the answer is that CMake follows a horribly complicated procedure to search all over the place for packages. In my case it seems that it found something under



                ~/.cmake/packages/<package>


                which then must have directed it to the strange prefix I was seeing. Deleting this package registry entry fixed the problem. The full search procedure that CMake follows is described towards the end of the find_package documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html






                share|improve this answer













                Ok I think the answer is that CMake follows a horribly complicated procedure to search all over the place for packages. In my case it seems that it found something under



                ~/.cmake/packages/<package>


                which then must have directed it to the strange prefix I was seeing. Deleting this package registry entry fixed the problem. The full search procedure that CMake follows is described towards the end of the find_package documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 12:48









                Ben FarmerBen Farmer

                824517




                824517






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412161%2fcmake-is-searching-for-packages-in-a-strange-location%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    RAC Tourist Trophy