Skip to content
Snippets Groups Projects
Commit f4fadf5a authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Use variable PROJECT_NAME to create src/CMakeLists.txt

parent 7a949292
No related branches found
No related tags found
1 merge request!1Install path
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -179,6 +179,7 @@ sed 's/project_name/'"$NAME"'/g' <doxygen_project_name_template.conf >./doc/doxy ...@@ -179,6 +179,7 @@ sed 's/project_name/'"$NAME"'/g' <doxygen_project_name_template.conf >./doc/doxy
rm doxygen_project_name_template.conf rm doxygen_project_name_template.conf
mv doxygen_template.conf ./doc/doxygen.conf mv doxygen_template.conf ./doc/doxygen.conf
PROJECT_NAME_VAR="\${PROJECT_NAME}"
#create the CMakeLists.txt script file #create the CMakeLists.txt script file
if [ $TYPE = application ] if [ $TYPE = application ]
then then
...@@ -194,23 +195,23 @@ then ...@@ -194,23 +195,23 @@ then
echo "INCLUDE_DIRECTORIES("'${'"${x}_INCLUDE_DIR"'}'")" >> CMakeLists.tmp echo "INCLUDE_DIRECTORIES("'${'"${x}_INCLUDE_DIR"'}'")" >> CMakeLists.tmp
done done
echo "# application source files" >> CMakeLists.tmp echo "# application source files" >> CMakeLists.tmp
echo "SET(sources ${NAME}.cpp)" >> CMakeLists.tmp echo "SET(sources ${PROJECT_NAME_VAR}.cpp)" >> CMakeLists.tmp
echo "# application header files" >> CMakeLists.tmp echo "# application header files" >> CMakeLists.tmp
echo "SET(headers ../include/${NAME}.h)" >> CMakeLists.tmp echo "SET(headers ../include/${PROJECT_NAME_VAR}.h)" >> CMakeLists.tmp
echo "# create the executable file" >> CMakeLists.tmp echo "# create the executable file" >> CMakeLists.tmp
echo "ADD_EXECUTABLE(${NAME} "'${'"sources"'}'")" >> CMakeLists.tmp echo "ADD_EXECUTABLE(${PROJECT_NAME_VAR} "'${'"sources"'}'")" >> CMakeLists.tmp
echo "# link necessary libraries" >> CMakeLists.tmp echo "# link necessary libraries" >> CMakeLists.tmp
for x in $arr for x in $arr
do do
echo "TARGET_LINK_LIBRARIES(${NAME} "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp echo "TARGET_LINK_LIBRARIES(${PROJECT_NAME_VAR} "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp
done done
mv CMakeLists.tmp ./src/CMakeLists.txt mv CMakeLists.tmp ./src/CMakeLists.txt
mv application_src_template.cpp ./src/$NAME.cpp mv application_src_template.cpp ./src/$NAME.cpp
else else
echo "# driver source files" >> CMakeLists.tmp echo "# driver source files" >> CMakeLists.tmp
echo "SET(sources ${NAME}.cpp)" >> CMakeLists.tmp echo "SET(sources ${PROJECT_NAME_VAR}.cpp)" >> CMakeLists.tmp
echo "# application header files" >> CMakeLists.tmp echo "# application header files" >> CMakeLists.tmp
echo "SET(headers ../include/${NAME}.h)" >> CMakeLists.tmp echo "SET(headers ../include/${PROJECT_NAME_VAR}.h)" >> CMakeLists.tmp
echo "# locate the necessary dependencies" >> CMakeLists.tmp echo "# locate the necessary dependencies" >> CMakeLists.tmp
for x in $arr for x in $arr
do do
...@@ -223,28 +224,28 @@ else ...@@ -223,28 +224,28 @@ else
echo "INCLUDE_DIRECTORIES("'${'"${x}_INCLUDE_DIR"'}'")" >> CMakeLists.tmp echo "INCLUDE_DIRECTORIES("'${'"${x}_INCLUDE_DIR"'}'")" >> CMakeLists.tmp
done done
echo "# create the shared library" >> CMakeLists.tmp echo "# create the shared library" >> CMakeLists.tmp
echo "ADD_LIBRARY(${NAME} SHARED "'${'"sources"'}'")" >> CMakeLists.tmp echo "ADD_LIBRARY(${PROJECT_NAME_VAR} SHARED "'${'"sources"'}'")" >> CMakeLists.tmp
echo "# link necessary libraries" >> CMakeLists.tmp echo "# link necessary libraries" >> CMakeLists.tmp
for x in $arr for x in $arr
do do
echo "TARGET_LINK_LIBRARIES(${NAME} "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp echo "TARGET_LINK_LIBRARIES(${PROJECT_NAME_VAR} "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp
done done
echo "INSTALL(TARGETS $NAME" >> CMakeLists.tmp echo "INSTALL(TARGETS $PROJECT_NAME_VAR" >> CMakeLists.tmp
echo " RUNTIME DESTINATION bin" >> CMakeLists.tmp echo " RUNTIME DESTINATION bin" >> CMakeLists.tmp
echo " LIBRARY DESTINATION lib/iri/${NAME}" >> CMakeLists.tmp echo " LIBRARY DESTINATION lib/iri/${PROJECT_NAME_VAR}" >> CMakeLists.tmp
echo " ARCHIVE DESTINATION lib/iri/${NAME})" >> CMakeLists.tmp echo " ARCHIVE DESTINATION lib/iri/${PROJECT_NAME_VAR})" >> CMakeLists.tmp
echo "INSTALL(FILES "'${'"headers"'}' "DESTINATION include/iri/${NAME})" >> CMakeLists.tmp echo "INSTALL(FILES "'${'"headers"'}' "DESTINATION include/iri/${PROJECT_NAME_VAR})" >> CMakeLists.tmp
echo "INSTALL(FILES ../Find$NAME.cmake DESTINATION "'${'"CMAKE_ROOT"'}'"/Modules/)" >> CMakeLists.tmp echo "INSTALL(FILES ../Find$PROJECT_NAME_VAR.cmake DESTINATION "'${'"CMAKE_ROOT"'}'"/Modules/)" >> CMakeLists.tmp
echo "ADD_SUBDIRECTORY(examples)" >> CMakeLists.tmp echo "ADD_SUBDIRECTORY(examples)" >> CMakeLists.tmp
mv CMakeLists.tmp ./src/CMakeLists.txt mv CMakeLists.tmp ./src/CMakeLists.txt
echo "# create an example application" >> CMakeLists.tmp echo "# create an example application" >> CMakeLists.tmp
echo "ADD_EXECUTABLE(${NAME}_test ${NAME}_test.cpp)" >> CMakeLists.tmp echo "ADD_EXECUTABLE(${PROJECT_NAME_VAR}_test ${PROJECT_NAME_VAR}_test.cpp)" >> CMakeLists.tmp
echo "# link necessary libraries" >> CMakeLists.tmp echo "# link necessary libraries" >> CMakeLists.tmp
echo "TARGET_LINK_LIBRARIES(${NAME}_test $NAME)" >> CMakeLists.tmp echo "TARGET_LINK_LIBRARIES(${PROJECT_NAME_VAR}_test $PROJECT_NAME_VAR)" >> CMakeLists.tmp
for x in $arr for x in $arr
do do
echo "TARGET_LINK_LIBRARIES(${NAME}_test "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp echo "TARGET_LINK_LIBRARIES(${PROJECT_NAME_VAR}_test "'${'"${x}_LIBRARY"'}'")" >> CMakeLists.tmp
done done
mv CMakeLists.tmp ./src/examples/CMakeLists.txt mv CMakeLists.tmp ./src/examples/CMakeLists.txt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment