CMake multiline generator expressions - cmake

How can I use multiline generator expressions? For example transforming this:
target_include_directories(application-smth
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/data>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/application-smth>
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
to this
target_include_directories(application-smth
PRIVATE
$<BUILD_INTERFACE:
${CMAKE_CURRENT_SOURCE_DIR}/data>
${CMAKE_CURRENT_SOURCE_DIR}/include/application-smth>
>
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
makes /include/application-smth folder headers not available

Related

Generating all fields Builder from lombok #Builder annotated class

I am wondering if there is a shortcut to create full builder without manually adding fields one by one from class annotated with Builder?
Let's say we have a class:
#Builder
public class Classroom {
private Long id;
private String name;
private String location;
private String fullName;
}
It creates Classroom.builder().build(), but instead of that I want to instantly unfold a code with every field added like:
Classroom.builder()
.id()
.name()
.location()
.fullName()
.build()
Any Intellij shortcut to make that happend?

Is there a per target set() method in modern CMake?

I'm trying to achieve the same behavior as set() function in CMake but using targets. Let's assume I have one main CMakeList and two sub-folders with one CMakeList each.
Foo CMakeLists.txt :
cmake_minimum_required(VERSION 3.8)
add_subdirectory(Bar)
add_subdirectory(Tox)
add_library(foo STATIC main.cpp)
#command to set UseFeatureA=ON
target_link_libraries(foo PUBLIC bar )
target_link_libraries(foo PUBLIC tox)
Bar CMakeLists.txt:
add_library(bar PUBLIC bar.cpp)
if(UseFeatureA) #This has to be true
target_sources(bar PRIVATE coolFeatureA.cpp)
endif()
Tox CMakeLists.txt:
add_library(tox STATIC tox.cpp)
if(UseFeatureA) #This has to be FALSE
target_sources(bar PRIVATE coolFeatureA.cpp)
endif()
I have tried target_compile_definition() in Foo but I don't know how to retrieve the var in Bar.
What am I doing wrong?

How do I declare field variable of tested class using apache velocity?

I'm trying to setup intellij idea code template for JUnit4 Test Class so that when I create the test it will also generate a field variable in the test. Example :
public class FooTest {
private Foo foo;
...
}
The problem I'm having is using the $CLASS_NAME variable to set the field name with lower camel case.
You can do a toLowerCase() of first character. Sample below for reference.
import static org.junit.Assert.*;
#parse("File Header.java")
public class ${NAME} {
${BODY}
#set($var_name = ${NAME})
#set($var_name = $var_name.substring(0,1).toLowerCase() + $var_name.substring(1))
private ${CLASS_NAME} $var_name;
}

FxCop giving a warning on private constructor CA1823 and CA1053

I have a class that looks like the following:
Public Class Utilities
Public Shared Function blah(userCode As String) As String
'doing some stuff
End Function
End Class
I'm running FxCop 10 on it and it says:
"Because type 'Utilities' contains only 'static' (
'Shared' in Visual Basic) members, add a default private
constructor to prevent the compiler from adding a default
public constructor."
Ok, you're right Mr. FxCop, I'll add a private constructor:
Private Utilities()
Now I'm having:
"It appears that field 'Utilities.Utilities' is
never used or is only ever assigned to. Use this field
or remove it."
Any ideas of what should I do to get rid of both warnings?
In C# this problem would be handled by marking the class as static, e.g.
public static class Utilities
{
...
}
A static class can only contain static (in VB shared) members.
I believe the equivalent in VB.NET is to use a module.
See Marking A Class Static in VB.NET.

Can you turn off the # that prepends all properties return by the Domino Data Service in 8.5.3

For the Domino Data Services which is new with 8.53 and the XPages Extension library I want to turn off the # that prepends all properties that are returned in the JSON data from a REST API call.
e.g. currently it looks like this:
"#title":"($DircatConfig)",
"#folder":false,
"#private":false,
"#modified":"2012-02-03T14:50:03Z",
"#unid":"50458575F2AA5F918525690D004F0AB5",
"#href":"http:\/\/192.168.1.30:80\/names.nsf\/api\/data\/collections\/unid\/50458575F2AA5F918525690D004F0AB5"
The # symbol is causing me grief in Javascript frameworks which can bind to the data directly as you cannot use the dot notation to bind to individual property names if the include an #.
The framework I am trying is http://angularjs.org/ and an example bind might be
{{databases.#title}} <-- doesnt work whereas {{databases.title}} <--works
I have tagged this as XPages as its related to the extension library.
The attribute names are set in the class com.ibm.domino.services.rest.RestServiceConstants of the extlib, for example:
...
public static final String ATTR_UNID = "#unid"; //$NON-NLS-1$
public static final String ATTR_NOTEID = "#noteid"; //$NON-NLS-1$
public static final String ATTR_LINK = "#link"; //$NON-NLS-1$
public static final String ATTR_LINK_REL = "rel"; //$NON-NLS-1$
public static final String ATTR_LINK_HREF = "href"; //$NON-NLS-1$
...
Since they are public static final Strings, you would have to extend DAS and use your extended classes.
However I believe you should be able to access the attributes in this manner instead of dot notation:
database['#title']
Hope this helps.