Re: [cmake-developers] Link element in C# project causing issues with binary dir
Submitted a fix here: https://gitlab.kitware.com/cmake/cmake/merge_requests/2177 David: I think the source dir is stripped because that path is effectively the same as source_group() command. It's a path relative to the root of the solution explorer panel. That's a big assumption, I honestly don't know what the inner workings of the CSPROJ file are. Yes, they are sibling directories On Fri, Jun 29, 2018 at 3:37 PM, David Cole wrote: > The code looks wrong like this, too: > > You shouldn't strip the source directory from the path of the file > name unless the character after the source directory is "/" or "\\", > should you? If the thing you're trying to end up with is a path name > to the file under the source directory, then this is incorrect in this > case. > > I'm guessing you have "layout-composer" and "layout-composer-build" as > sibling directories of each other? > > > > On Fri, Jun 29, 2018 at 4:12 PM Robert Dailey > wrote: >> >> According to the code, the logic is wrong: >> >> void cmVisualStudio10TargetGenerator::GetCSharpSourceLink( >> cmSourceFile const* sf, std::string& link) >> { >> std::string f = sf->GetFullPath(); >> if (!this->InSourceBuild) { >> const std::string stripFromPath = >> this->Makefile->GetCurrentSourceDirectory(); >> if (f.find(stripFromPath) != std::string::npos) { >> link = f.substr(stripFromPath.length() + 1); >> if (const char* l = sf->GetProperty("VS_CSHARP_Link")) { >> link = l; >> } >> ConvertToWindowsSlash(link); >> } >> } >> } >> >> >> It's checking if the whole binary dir is rooted where source dir is, >> instead it should be checking each file to see if they are descendents >> of CMAKE_BINARY_DIR, and if so, use the , otherwise don't use >> it. This allows to be variable between files in the project. >> >> Does anyone know if there's already a function in CMake for checking >> if a file is in the CMAKE_BINARY_DIR? Or do I have to write my own >> code for that check? >> >> On Fri, Jun 29, 2018 at 3:08 PM, Robert Dailey >> wrote: >> > When I use configure_file() to generate AssemblyInfo.cs, which I allow >> > to go to the CMAKE_CURRENT_BINARY_DIR, Visual Studio 2017 reports: >> > >> > Warning The file >> > 'E:\code\layout-composer-build\Properties\AssemblyInfo.cs' could not >> > be added to the project. Cannot add a link to the file >> > E:\code\layout-composer-build\Properties\AssemblyInfo.cs. This file is >> > within the project directory tree. >> > >> > When I define a target using C# language, it adds this for files under >> > the same directory as the generated CSPROJ file: >> > >> > > > Include="E:\code\layout-composer-build\Properties\AssemblyInfo.cs"> >> > build\Properties\AssemblyInfo.cs >> > >> > >> > The CSPROJ file is located: >> > E:\code\layout-composer-build\LayoutComposer.csproj >> > >> > Is there a way to make the element not needed in this scenario? >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> https://cmake.org/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers
Re: [cmake-developers] Link element in C# project causing issues with binary dir
The code looks wrong like this, too: You shouldn't strip the source directory from the path of the file name unless the character after the source directory is "/" or "\\", should you? If the thing you're trying to end up with is a path name to the file under the source directory, then this is incorrect in this case. I'm guessing you have "layout-composer" and "layout-composer-build" as sibling directories of each other? On Fri, Jun 29, 2018 at 4:12 PM Robert Dailey wrote: > > According to the code, the logic is wrong: > > void cmVisualStudio10TargetGenerator::GetCSharpSourceLink( > cmSourceFile const* sf, std::string& link) > { > std::string f = sf->GetFullPath(); > if (!this->InSourceBuild) { > const std::string stripFromPath = > this->Makefile->GetCurrentSourceDirectory(); > if (f.find(stripFromPath) != std::string::npos) { > link = f.substr(stripFromPath.length() + 1); > if (const char* l = sf->GetProperty("VS_CSHARP_Link")) { > link = l; > } > ConvertToWindowsSlash(link); > } > } > } > > > It's checking if the whole binary dir is rooted where source dir is, > instead it should be checking each file to see if they are descendents > of CMAKE_BINARY_DIR, and if so, use the , otherwise don't use > it. This allows to be variable between files in the project. > > Does anyone know if there's already a function in CMake for checking > if a file is in the CMAKE_BINARY_DIR? Or do I have to write my own > code for that check? > > On Fri, Jun 29, 2018 at 3:08 PM, Robert Dailey > wrote: > > When I use configure_file() to generate AssemblyInfo.cs, which I allow > > to go to the CMAKE_CURRENT_BINARY_DIR, Visual Studio 2017 reports: > > > > Warning The file > > 'E:\code\layout-composer-build\Properties\AssemblyInfo.cs' could not > > be added to the project. Cannot add a link to the file > > E:\code\layout-composer-build\Properties\AssemblyInfo.cs. This file is > > within the project directory tree. > > > > When I define a target using C# language, it adds this for files under > > the same directory as the generated CSPROJ file: > > > > > > build\Properties\AssemblyInfo.cs > > > > > > The CSPROJ file is located: > > E:\code\layout-composer-build\LayoutComposer.csproj > > > > Is there a way to make the element not needed in this scenario? > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers
Re: [cmake-developers] Link element in C# project causing issues with binary dir
According to the code, the logic is wrong: void cmVisualStudio10TargetGenerator::GetCSharpSourceLink( cmSourceFile const* sf, std::string& link) { std::string f = sf->GetFullPath(); if (!this->InSourceBuild) { const std::string stripFromPath = this->Makefile->GetCurrentSourceDirectory(); if (f.find(stripFromPath) != std::string::npos) { link = f.substr(stripFromPath.length() + 1); if (const char* l = sf->GetProperty("VS_CSHARP_Link")) { link = l; } ConvertToWindowsSlash(link); } } } It's checking if the whole binary dir is rooted where source dir is, instead it should be checking each file to see if they are descendents of CMAKE_BINARY_DIR, and if so, use the , otherwise don't use it. This allows to be variable between files in the project. Does anyone know if there's already a function in CMake for checking if a file is in the CMAKE_BINARY_DIR? Or do I have to write my own code for that check? On Fri, Jun 29, 2018 at 3:08 PM, Robert Dailey wrote: > When I use configure_file() to generate AssemblyInfo.cs, which I allow > to go to the CMAKE_CURRENT_BINARY_DIR, Visual Studio 2017 reports: > > Warning The file > 'E:\code\layout-composer-build\Properties\AssemblyInfo.cs' could not > be added to the project. Cannot add a link to the file > E:\code\layout-composer-build\Properties\AssemblyInfo.cs. This file is > within the project directory tree. > > When I define a target using C# language, it adds this for files under > the same directory as the generated CSPROJ file: > > > build\Properties\AssemblyInfo.cs > > > The CSPROJ file is located: > E:\code\layout-composer-build\LayoutComposer.csproj > > Is there a way to make the element not needed in this scenario? -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers
[cmake-developers] Link element in C# project causing issues with binary dir
When I use configure_file() to generate AssemblyInfo.cs, which I allow to go to the CMAKE_CURRENT_BINARY_DIR, Visual Studio 2017 reports: Warning The file 'E:\code\layout-composer-build\Properties\AssemblyInfo.cs' could not be added to the project. Cannot add a link to the file E:\code\layout-composer-build\Properties\AssemblyInfo.cs. This file is within the project directory tree. When I define a target using C# language, it adds this for files under the same directory as the generated CSPROJ file: build\Properties\AssemblyInfo.cs The CSPROJ file is located: E:\code\layout-composer-build\LayoutComposer.csproj Is there a way to make the element not needed in this scenario? -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers
[cmake-developers] [ANNOUNCE] CMake 3.12.0-rc2 is ready for testing
I am proud to announce the second CMake 3.12 release candidate. https://cmake.org/download/ Documentation is available at: https://cmake.org/cmake/help/v3.12 Release notes appear below and are also published at https://cmake.org/cmake/help/v3.12/release/3.12.html Some of the more significant changes in CMake 3.12 are: * The "target_link_libraries()" command now supports Object Libraries. Linking to an object library uses its object files in direct dependents and also propagates usage requirements. * The "target_link_libraries()" command may now be called to modify targets created outside the current directory. * The "file(GLOB)" and "file(GLOB_RECURSE)" commands learned a new flag "CONFIGURE_DEPENDS" which enables expression of build system dependency on globbed directory's contents. * The "Compile Features" functionality is now aware of C++ 20. No specific features are yet enumerated besides the "cxx_std_20" meta- feature. * The Visual Studio Generators for VS 2017 learned to support a "version=14.##" option in the "CMAKE_GENERATOR_TOOLSET" value (e.g. via the "cmake(1)" "-T" option) to specify a toolset version number. * The "cmake(1)" Build Tool Mode ("cmake --build") gained "-- parallel []" and "-j []" options to specify a parallel build level. They map to corresponding options of the native build tool. * The "add_compile_definitions()" command was added to set preprocessor definitions at directory level. This supersedes "add_definitions()". * The "cmake_minimum_required()" and "cmake_policy(VERSION)" commands now accept a version range using the form "[...]". The "" version is required but policies are set based on the "" version. This allows projects to specify a range of versions for which they have been updated and avoid explicit policy settings. * The "find_package()" command now searches a prefix specified by a "PackageName_ROOT" CMake or environment variable. Package roots are maintained as a stack so nested calls to all "find_*" commands inside find modules also search the roots as prefixes. See policy "CMP0074". * A new "$" and "$" "generator expression" has been added to enable consumption of generator expressions whose evaluation results itself in generator expressions. * A new "$" "generator expression" has been added. * A new "$" "generator expression" has been added. * The "FindCURL" module now provides imported targets. * The "FindJPEG" module now provides imported targets. * A "FindODBC" module was added to find an Open Database Connectivity (ODBC) library. * New "FindPython3" and "FindPython2" modules, as well as a new "FindPython" module, have been added to provide a new way to locate python environments. CMake 3.12 Release Notes Changes made since CMake 3.11 include the following. New Features Generators -- * The Visual Studio Generators for VS 2017 learned to support a "version=14.##" option in the "CMAKE_GENERATOR_TOOLSET" value (e.g. via the "cmake(1)" "-T" option) to specify a toolset version number. Command-Line * The "cmake(1)" Build Tool Mode ("cmake --build") gained "-- parallel []" and "-j []" options to specify a parallel build level. They map to corresponding options of the native build tool. Commands * The "add_compile_definitions()" command was added to set preprocessor definitions at directory level. This supersedes "add_definitions()". * The "cmake_minimum_required()" and "cmake_policy(VERSION)" commands now accept a version range using the form "[...]". The "" version is required but policies are set based on the "" version. This allows projects to specify a range of versions for which they have been updated and avoid explicit policy settings. * The "file(GLOB)" and "file(GLOB_RECURSE)" commands learned a new flag "CONFIGURE_DEPENDS" which enables expression of build system dependency on globbed directory's contents. * The "file(TOUCH)" and "file(TOUCH_NOCREATE)" commands were added to expose "TOUCH" functionality without having to use CMake's command- line tool mode with "execute_process()". * The "find_package()" command now searches a prefix specified by a "PackageName_ROOT" CMake or environment variable. Package roots are maintained as a stack so nested calls to all "find_*" commands inside find modules also search the roots as prefixes. See policy "CMP0074". * The "install()" command learned an optional "NAMELINK_COMPONENT" parameter, which allows you to change the component for a shared library's namelink. If none is specified, the value of "COMPONENT" is used by default. * The "list()" command learned a "JOIN" sub-command to concatenate list's elements separated by a glue string. * The "list()" command learned a "SUBLIST" sub-command to get a sublist of the list. * The "list()" command learned a "TRANSFORM" sub-command to apply