Set up CMakeLists to not change the include statements from TFS project in Android Studio

▼魔方 西西 提交于 2019-12-25 09:19:31

问题


From a previous question a new one have arisen. I want to include 2 native TFS project libraries stored in two different folders, dependant from each other in my Android Studio project (stored in another folder). If i not specify "../my_lib_path/libFile.h" instead of simply the "libFile.h" i get the error the file is not found. But i dont want to change all includes since it is a TFS project and there are lots of file contained in the libraries!

Your help is highly appreciated!


回答1:


Add the given directories to those the compiler uses to search for include files. Relative paths are interpreted as relative to the current source directory. So you have to specify "../my_lib_path/libFile.h", that means you need to change all includes, otherwise it will not work.




回答2:


@Andy Li-MSFT is absolutely right! Though what worked for me in a similar project now was to set a different relative CMakeLists.txt path in the app .gradle file outside the specific Android Studio Project directory:

externalNativeBuild {
        cmake {
            path "../../whatever_path/my_C_files/CMakeLists.txt"
        }
    }

After that i was able to compile my C sources flawlessly without changing the include paths of the C project!



来源:https://stackoverflow.com/questions/44495437/set-up-cmakelists-to-not-change-the-include-statements-from-tfs-project-in-andro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!