<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi Peter, <br></div>Thanks for your quick reply.<br><br></div>My file structure is as such<br></div><div>someFolder/<br></div>                  library/code/include/<u>sameName.h</u><br></div>                  library/code/include/anotherName.h<br></div>                  library/code/source/sameName.cpp<br></div>                  library/code/source/anotherName.cpp<br>                  <br></div>                  application/code/include/<u>sameName.h</u><br></div>                  application/code/include/yetAnotherName.h<br></div>                  application/code/source/<u>sameName.cpp</u><br></div>                  application/code/source/yetAnotherName.cpp<br><br></div><b>My CMakeLists.txt for the library:</b><br>cmake_minimum_required(VERSION 3.0 FATAL_ERROR)<br></div>project(library)<br></div>set(Headers include/sameName.h<br></div>                   include/anotherName.h)<br><br></div>set(Sources source/sameName.cpp<br></div>                   sources/anotherName.h)<br></div>set(CMAKE_AUTOMOC ON)<br></div>include_directories(include)<br></div>add_library(${PROJECT_NAME} STATIC ${Headers} ${Sources})<br></div>target_link_libraries(${PROJECT_NAME})<br><br></div><b>CMakeLists.txt for the application:</b><br>cmake_minimum_required(VERSION 3.0 FATAL_ERROR)<br></div>project(application)<br></div>set(Headers include/sameName.h<br></div>                   include/yetAnotherName.h)<br></div>set(Sources source/sameName.cpp<br></div>                   source/yetAnotherName.cpp)<br></div>set(CMAKE_AUTOMOC ON)<br></div>set(CMAKE_AUTORCC ON)<br></div>set(LIBRARY_ROOT ${PROJECT_SOURCE_DIR}/../../library)<br><br></div>include_directories(include)<br></div>include_directories(include/remotes)<br></div>include_directories($LIBRARY_ROOT}/code/include)<br></div>include_directories(${PROJECT_BINARY_DIR}<br><br></div>add_subdirectory(${LIBRARY_ROOT}/code library)<br></div>add_executable(${PROJECT_NAME} ${Forms} ${Headers} resources/${PROJECT_NAME}.qrc ${Sources})<br></div>target_link_libraries(${PROJECT_NAME} library)<br><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><br></div><div>I hope that helps understanding my problem. Since the content of sameName.h and sameName.cpp of the library is different from those of the application it doesn't build. However, it would be confusing to name them differently since their job is the same. <br><br></div><div>Thanks in advance,<br></div><div>Jan<br></div><div><div><div><div><div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 8, 2015 at 9:03 AM Petr Kmoch <<a href="mailto:petr.kmoch@gmail.com">petr.kmoch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Jan,<br><br></div>it'simpossible to answer such questions without seeing your setup. Can you post your CMakeList and your directory structure?<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 7, 2015 at 6:36 PM, Jan Steinke <span dir="ltr"><<a href="mailto:jan.steinke@gmail.com" target="_blank">jan.steinke@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Dear all,<br></div>I came across a problem, for me it seems that cmake does not allow header files to be have the same name. Or am I doing something wrong?<br><br></div>I have two projects, a library and an application. Both have files with similar content, but the same file names. I am using cmake to compile the app and the aim is that cmake also compiles the library if it doesn't yet exist. I was stuck for a few days on that problem until I figured out that it was due to the same file names. When renaming the files in my application it builds correctly. Before I switched to cmake a week ago, I used qmake integrated into Qt Creator, and it compiled just fine.<br><br></div>Is it wanted behavior, that cmake does not allow the same file names? Am I doing something wrong? Altough it works with renaming the files I would like to find a "cleaner" way that prevents this from happening in the future, having same file names is nothing you can prevent if you work in a team.<br><br></div>I hope you are able to help me,<br></div>Jan<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div dir="ltr">-- <br></div>Jan
</font></span><br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>
</blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div dir="ltr">-- <br></div>Jan